Closed
Description
I'm trying to follow the docs on server side rendering, and inside the function handleRender it calls renderToString with JSX elements. Code here:
https://github.com/reactjs/redux/blob/master/docs/recipes/ServerRendering.md
function handleRender(req, res) {
// Create a new Redux store instance
const store = createStore(counterApp)
// Render the component to a string
const html = renderToString(
<Provider store={store}>
<App />
</Provider>
)
// Grab the initial state from our Redux store
const preloadedState = store.getState()
// Send the rendered page back to the client
res.send(renderFullPage(html, preloadedState))
}
This code lives inside the server.js file, alongside the express app. After looking at other parts of the docs, it seems that JSX components are put under the /components directory. Is it implied that this file needs to be compiled also? I don't see anything on that page mentioning that, but otherwise it's not going to work. It seems strange even for the components to have a .js file ending, when they include jsx in them.
Metadata
Metadata
Assignees
Labels
No labels