const { h } = require('jsx-node'); module.exports = function (Component, Master) { const locals = Object.assign({ query: this.req.query }, this.app.locals, this.locals); if (typeof Master === 'function') { if (typeof Component === 'function') { return this.send( h(Master, locals, h(Component, locals) ) ); } Component = Master; } if (typeof Component !== 'function') { throw new Error('Not a Component'); } else if (Component.prototype && Component.prototype.render) { const i = new Component(locals); this.send(i.render(i.props, i.state)); } else { this.send(Component(locals)); } };