D
D
DonorOfLove2021-11-25 07:57:17
React
DonorOfLove, 2021-11-25 07:57:17

What is the difference between the two react-router syntaxes?

I am writing a small project in React and using react-router version 6.0.1 in it, and I have a question: I have read various articles, including the official one, everywhere it is described in different ways how to pass a component to the element attribute (pass a tag / pass a component ) moreover, both of these routes work, but under certain conditions (when and how is not clear), so, I ask you to help me understand the differences between these two variants of writing routes:

<Route path='/' element={MainMenu}/>
<Route path='/BattleGround/*' element={<BattleGround/>}/>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Masson, 2021-11-25
@DonorOfLove

in version 6 of the route, it only works with the second option, and the nesting of routers was also removed there, more details here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question