Skip to content

Simple server rendering #1100

Closed
Closed
@brigand

Description

@brigand

There have been some people asking for server rendering with node.js, but what if instead we did server rendering agnostic of the backend?

The idea is to create a UMD build which exports one function. The function takes some arguments and returns a renderToString result. The generated version of this entry point would be very simple, but it could be extended by the user to support react-router, redux, etc. They can add these things without ejecting, which is nice.

module.exports = (options) => ReactDOMServer.renderToString(<App data={options.data} />);

This bundle could be used in node.js with a simple require(), or loaded into phpv8 or similar and expose a global.

Building this bundle would be a separate build task with an optional watch mode. For node users, nodemon would pick up the bundle change and restart the server.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions