function handleRender(req, res) {
  const params = qs.parse(req.query);
  const initState = parseInt(params.counter, 10) || 0;

  // Create a new Redux store instance
  const store = createStore(counterApp, initState);

  // Render the component to a string
  const html = renderToString(
    <Provider store={store}>
      <App />
    </Provider>
  );

  // Grab the initial state from our Redux store
  const finalState = store.getState();

  // Send the rendered page back to the client
  res.send(renderFullPage(html, finalState));
}
// We are going to fill these out in the sections to follow
We are going to fill these out in the sections to follow
We are going to fill these out in the sections to follow
function handleRender(req, res) {
  const params = qs.parse(req.query);
  const initState = parseInt(params.counter, 10) || 0;
  const store = createStore(counterApp, initState);
  const html = renderToString(
    <Provider store={store}>
      <App />
    </Provider>
  );
  const finalState = store.getState();
  res.send(renderFullPage(html, finalState));
}
function handleRender ( req , res ) { const params = qs . parse ( req . query ) ; const initState = parseInt ( params . counter , 10 ) || 0 ; const store = createStore ( counterApp , initState ) ; const html = renderToString ( < Provider store = { store } > < App / > < / Provider > ) ; const finalState = store . getState ( ) ; res . send ( renderFullPage ( html , finalState ) ) ; }
We are going to fill these out in the sections to follow
We are going to fill these out in the sections to follow
// Create a new Redux store instance // Render the component to a string // Grab the initial state from our Redux store // Send the rendered page back to the client