react router v4 default page(not found page)

前端 未结 4 1133
生来不讨喜
生来不讨喜 2020-11-27 13:28

This is common purpose, directing unmatch request to notfound page.

making this with react-router v4 looks like previous versions and I expect this sample works bel

4条回答
  •  感情败类
    2020-11-27 14:10

    It does not work for me, particularly one is using this config

    So, I have to check the path in the render function of Homepage component. Something like this:

    render(){
    const {match, location, history} = this.props;
    if (location.pathname === '/'){
    return (
    Home
    ) }else{ return null } }

提交回复
热议问题