reactjs - React-router universal. Why Root component does not re-renders? -
i have universal app (server rendering). routes.js looks this
routes.js
<route path="/" component={root}> <route path="sales/:id" component={view} /> ... </route>
--
root.js
class root extends component { ... render() { return ( <div> <header {...someprops} /> {this.props.children} </div> ); } }
--
server.js
app.use((req, res) => { match({ routes, location: req.url }, (error, redirectlocation, renderprops) => { if (error) { ... } else if (redirectlocation) { ... } else if (renderprops) { const initialstate = {}; const store = configurestore(initialstate); fetchcomponentdata(store.dispatch, renderprops.components, renderprops.params).then(() => { const html = rendertostring( <provider store={store}> <routercontext {...renderprops} /> </provider> ); res.status(200).send(renderfullpage({ html, initialstate: store.getstate()})); }); } else { ... } }); });
my root , view components connected store (redux). works without server rendering , initial rendering on server works good. problem begins when trying change state , expect root component new props , re-render tree, in case root component not re-renders , view component re-renders.
i can't understand how can be? why part of tree static html?
update: have not found answer yet, assume root not giving new state. if why root component not connected store?
Comments
Post a Comment