Router.match is not been called on every route change

前端 未结 1 1541
走了就别回头了
走了就别回头了 2021-01-23 08:00

I have server side rendering app and using react-router for routing. I was using Router.Run Before as the method is no more I am using Router.Match

1条回答
  •  故里飘歌
    2021-01-23 08:58

    I have defined my router in entry module defined below and it will go to Layout component to look for route paths:

    import { Router, Route, IndexRoute, hashHistory } from "react-router";
        ReactDOM.render(
        
         
        //
        
        
        
        
        ,
        document.getElementById('app'));
    

    Layout component will bind the path defined in router to different components in Layout Component

    import { Link } from "react-router";
        class Layout extends React.Component(
    
        render(){
        return(
    
        {this.props.children}
         
  • archives
  • settings
  • featured
  • ) } );

    You can define any action for your route components.its working fine for me

    0 讨论(0)
提交回复
热议问题