Meteor authentication and react-router -
how meteor re-render components when sign in using accounts-password package?
my react-router routes are:
import react, { component } 'react' import reactdom 'react-dom' import { router, route, indexroute, browserhistory } 'react-router' import app './containers/app' import recordings './containers/recordings' import landingpage './containers/landingpage' import { bloodpressure } '../collections/bloodpressure' const routes = ( <router history={browserhistory}> <route path="/" component={app}> <indexroute component={landingpage} /> <route path="dashboard" component={recordings} /> </route> </router> ) meteor.startup( ()=> { reactdom.render(routes, document.queryselector('.render-target')) })
my app component is:
import react, { component } 'react' import { createcontainer } 'meteor/react-meteor-data' import { browserhistory } 'react-router' import header './header' class app extends component { constructor(props) { super(props) } render() { return( <div> <div classname="ui 4 container"> <header /> {this.props.children} </div> <div classname="footer"> <p>designed , developed <a href="http://thomashoadley.co.uk" target="_blank">thomas hoadley</a></p> </div> </div> ) } } export default createcontainer(() => { return { signedin: meteor.userid() } }, app)
when sign in, expect page automatically reload correct routes, having reload page manually redirect it.
any on issue appreciated!
Comments
Post a Comment