javascript - react redux router display blank page -
i have index.js like:
render( <root store={store} />, document.getelementbyid('root') )
and root.js
like:
class root extends component { render() { const { store } = this.props return ( <provider store={store}> <reduxrouter /> </provider> ) } } root.proptypes = { store: proptypes.object.isrequired } export default root
and routes.js
like:
export default ( <route path="/" component={app}> </route> )
and app.js
like:
class app extends component { render() { <div> <p>some cool header</p> </div> } } export default app
but when access web via localhost:3000
show blank page.. expect show <p>some cool header</p>
it not give error.. issue here..
you have not passed routes reduxrouter
component inside of root
component render function. why app
not being rendered , see blank page!
update root.js
like:
import routes './routes' class root extends component { render() { const { store } = this.props return ( <provider store={store}> <reduxrouter> {routes} </reduxrouter> </provider> ) } } root.proptypes = { store: proptypes.object.isrequired } export default root
you should see desired output in browser.
Comments
Post a Comment