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

后端 未结 7 1334
有刺的猬
有刺的猬 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:56

    The router actually should never change, so you should be able to just return false for shouldComponentUpdate() in this case.

    import React from 'react'
    import ReactDOM  from 'react-dom'
    import { Router, Route, Link } from 'react-router'
    import App from './index/app'
    import About from './index/about'
    import Inbox from './index/inbox'
    class Routers extends React.Component {
    
      shouldComponentUpdate(){
         return false;
      }
    
      render() {
         return ( 
            
                
                  
                  
                
            
          );
        }
    }
    

提交回复
热议问题