Async React.renderToString for server-side rendering
See original GitHub issueIt would really help if we could use the async
version of the React.renderToString
when rendering on the server-side.
app.get('*', function (req, res) {
Router.run(routes, req.path, (Handler, router) => {
// var content = React.renderToString(<Handler/>);
// res.render('index', { content: content });
React.renderToString(<Handler/>, function(content) {
res.render('index', { content: content });
});
});
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
React server-side fetch (asynchronous rendering)
When you call renderToString from the server, react will call the constructor, componentWillMount and render, then create a string from the ...
Read more >ReactDOMServer – React
renderToString () Render a React element to its initial HTML. React will return an HTML string. You can use this method to generate...
Read more >Resolving async state while server-rendering · Pullstate
Universal fetching. Any action that is making use of useBeckon() (discussed in detail here) in the current render tree can have its state...
Read more >Asynchronous Server side rendering with React - Medium
I'll try to keep this short and simple : This post will go over an implementation of asynchronous server side rendering in a...
Read more >Dealing with Asynchronous APIs in Server-rendered React
You can add back traditional server-side rendering of web pages, typically with NodeJS, but this isn't a straightforward process, especially ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There’s new work in this area in https://github.com/facebook/react/pull/20970.
Thanks! Following #3009 then.