I'm trying to do server side rendering with an application made in ASP.NET MVC, using ReactJS and Redux. I'm using ReacJS.Net.
My components are fine with client rendering.
My application could be the one of the example from here : http://redux.js.org/docs/basics/UsageWithReact.html. Here the main code (for client rendering) .
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import todoApp from './reducers'
import App from './components/App'
let store = createStore(todoApp)
render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
)
How to do this with ReacJS.NET with server-side rendering ?
<script>window.__MY_STATE__ = {...}</script>
. In the client you can retrieve the state from that variable. It's not beautiful, but it works and it's a common technique. – Touchstone