reactjs - react redux hash based routing -


i have router like:

<router history={browserhistory}>         <route path="/" component={app}>         <indexroute component={login} />         <route path="/#!login" component={login} />         <route path="/#!first" component={first} />         <route path="/#!second" component={second} />         </route>   </router> 

and have header component :

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 

now when click first in headers not redirect me link..

how can implement hash based routing in react , redux

use hashhistory, , let routes should aware of history. instead:

import { hashhistory } 'react-router';  <router history={hashhistory}>     <route path="/" component={app}>         <indexroute component={login} />         <route path="login" component={login} />         <route path="first" component={first} />         <route path="second" component={second} />     </route> </router> 

link this:

<link to="/first">first</link> 

and let router rest.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -