如何使用路由路径前往

huangapple go评论63阅读模式
英文:

How do I use Route path to go

问题

我尝试学习react navigation,使用路由和路由路径,但似乎我在某个地方犯了错误,有人能帮我吗?

我试图不断更改div和显示帖子的div,但现在它什么都不显示,它曾经显示帖子和按钮,但无法前进。

英文:

I'm trying to learn react navigation, using route and route path but I seem to be making mistake somewhere, can anyone help me with it?

I tried to keep changing the div and the div that shows the posts but it doesn't show anything now, it was showing the posts and the buttons but couldn't go to

答案1

得分: 1

需要将组件更改为element

<Routes>
    <Route path="/profile" element={<Profile />} />
</Routes>
英文:

You need to change the Component to element

&lt;Routes&gt;
        &lt;Route path=&quot;/profile&quot; element={&lt;Profile/&gt;} /&gt;
&lt;/Routes&gt;

答案2

得分: 1

代替组件,你应该使用元素

<Routes>
    <Route path="/profile" element={<Profile />} />
</Routes>
英文:

Instead of component you should use element

&lt;Routes&gt;
    &lt;Route path=&quot;/profile&quot; element={&lt;Profile/&gt;} /&gt;

</Routes>

huangapple
  • 本文由 发表于 2023年6月15日 15:15:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76479995.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定