@hyperapp/render
Version:
Render Hyperapp to an HTML string with SSR and Node.js streaming support
19 lines (14 loc) • 424 B
JavaScript
import { renderToString } from './index'
export { renderToString }
export function withRender(nextApp) {
return (initialState, actionsTemplate, view, container) => {
const actions = nextApp(
initialState,
{ ...actionsTemplate, getState: () => (state) => state },
view,
container,
)
actions.toString = () => renderToString(view, actions.getState(), actions)
return actions
}
}