reactjs - react router cannot access child url from browser -


here redux route:

const routes =  (     <router history={browserhistory}>         <route path="/" component={app}>         <indexroute component={login} />         <route name="first" path="/first" component={first} />         <route name="second" path="/second" component={second} />         </route>   </router> )  export default routes 

my app component have header , :

class header extends component {   render() {     return (       <div>         <h3><link to="first">first</link></h3>         <h3><link to="second">second</link></h3>       </div>     )   } }  export default header 

this works fine.. header rendered , when click routed thier respective url..

what facing problem can route on click.. when access /first url browser getting 404.

when access / redirects me login page header , on clicking header can route when directly call /first browser giving me 404 error .

why ??

would glad if answers

you need configure server return application on path hits it. can use catch pattern *.

so within server (assuming node.js server)

app.get('*', function (req, res) {     res.sendfile(path.join(__dirname + '/index.html')); }); 

and kick off router on client side.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -