(1) 从react-router-dom里导入Switch,Route和Redirect组件:
(2) 路径/home指定成加载Home Component ,/detail则加载Detail Component.
文件Home.jsx和Detail.jsx分别实现Component:
(3) 测试:url后加上/home,则加载home Component:
/detail组件的加载:
2021-10-07 09:36:02
(1) 从react-router-dom里导入Switch,Route和Redirect组件:
(2) 路径/home指定成加载Home Component ,/detail则加载Detail Component.
文件Home.jsx和Detail.jsx分别实现Component:
(3) 测试:url后加上/home,则加载home Component:
/detail组件的加载: