在使用v6时,使用v5的注册路由方法,出现报错。报错如下:
Matched leaf route at location "/about" does not have an element. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.
解决方法:
原来“注册路由”代码:
<Route path="/about" component={About}/>
<Route path="/home" component={Home}/>
现在的代码:
<Route path="/about" element={<About/>}/>
<Route path="/home" element={<Home/>}/>