i having trouble when using navigation bar move away route not accessible it.
here navbar:
when use clicks on search
presented table of charities listed in country. route search
page is:
<route path="search" component={searchcontainer} />
from table click on particular charity taken it's page. route is:
<route path="charity/:registeredcharitynumber" component={charitypagecontainer} />
the problem once viewing charity, clicking on item in navigation navigation bar results in error in web console:
the nav bar works before after visit charity page route see error. way fix browser reload. clicking on error in browser debug view highlights (4th line) section of code:
this router looks like:
export const renderroutes = () => ( <router history={browserhistory}> <route path="/" component={app}> <indexroute component={homepagecontainer} /> <route path="about" component={aboutpage} /> <route path="search" component={searchcontainer} /> <route path="contact" component={contactpage} /> <route path="thankyou" component={thankyou} /> <route path="charity/:registeredcharitynumber" component={charitypagecontainer} /> </route> </router> );
here charitypagecontainer:
export default createcontainer(( { params: { registeredcharitynumber }} ) => { const charnum = parseint(registeredcharitynumber); const subscriptionhandle = meteor.subscribe('current.charity', charnum); console.log('charity object ',currentcharity(charnum).fetch()[0]); const loading = !subscriptionhandle.ready(); return { subscriptionhandle, loading, charity: currentcharity(charnum).fetch()[0] }; }, charitypage);
and important section of navbar component:
<link activeclassname="active" classname="item" to="/">home</link> <link activeclassname="active" classname="item" to="/about">about</link> <link activeclassname="active" classname="item" to="/search">search</link> <link activeclassname="active" classname="item" to="/contact">contact</link>
using "react": "^15.2.1", "react-router": "^2.6.0",
Comments
Post a Comment