url参数,Route组件参数可用冒号标识参数
/blogs/:id this.props.match.params.id
Redirect组件 跳转
Switch只渲染一个子Route组件
<Switch
>
{ '只渲染命中的第一个Route' }
<Route path
="/" exact component
={App
}></Route
>
<Route path
="/erying" component
={Erying
}></Route
>
<Route path
="/qibinglian" component
={Qibinglian
}></Route
>
<Route path
="/:location" component
={Test
}></Route
>
</Switch
>
页面输入:http://localhost:3000/gogo会渲染Test组件