当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Reactjs: Invariant Violation: You may not have more than one route named "universal-search"

问题描述:

I need to have the same sub-route in 2 different routes

<Route name="app" path="/" handler={App}>

<Route name="management" path="management" handler={Management}>

<Route name="universal-search" path="universal-search" handler={UniversalSearch} />

<Route name="game-info" path="game-info" handler={GameInfo} />

<DefaultRoute handler={UniversalSearch} />

</Route>

<Route name="operations" path="operations" handler={Operations}>

<Route name="universal-search" path="universal-search" handler={UniversalSearch} />

<Route name="videos" path="videos" handler={Videos} />

<DefaultRoute handler={UniversalSearch} />

</Route>

<DefaultRoute handler={UniversalSearch} />

</Route>

<Route name="login" handler={Login} />

the route I need is this one

<Route name="universal-search" path="universal-search" handler={UniversalSearch} />

But I am getting the error in the question

Invariant Violation: You may not have more than one route named "universal-search"

I need to move among routes, and persist that route, what should I do ?

分享给朋友:
您可能感兴趣的文章:
随机阅读: