withRouter与@withRouter
包裹非路由组件,将match,location,history等路由信息添加到非路由组件的this.props中
import {withRouter} from 'react-router';
let app = ()=>{
return (<div></div>)
}
export default withRouter(app)
//
@withRouter
class app extend component{
render(){
this.props.history;
return (<div></div>)
}
}