react-route,react-hot-loader.webpack (You cannot change ; it will be ignored)

后端 未结 7 1342
有刺的猬
有刺的猬 2021-02-13 13:16

it\'s my first project that use react,react-router,react-hot-loader,webpack-dev-server and webpack. when I chang

7条回答
  •  忘了有多久
    2021-02-13 13:29

    Only thing you need to do, it's to throw out of render() method.
    So, there are many ways to solve this issue.
    Most Official way is what @Stormy say.
    My solution like this:

    const routes = (
      
        
        
      
    )
    
    // Don't let  in render() method
    class Routers extends React.Component {
      render() {
         return ( 
            
              { routes }
            
          );
        }
    }
    

提交回复
热议问题