I have a component in which I want to create an object or to edit an object, basically I have the same path, it only depends if it got an id or not, but lately the react-router-dom doesn’t allow me to give an array of strings as a parameter. How can I achieve the same result?
return (
<>
<NavBar />
<Container style={{marginTop: '7em'}}>
<Routes>
<Route path='/' Component={HomePage}/>
<Route path='/arenas' Component={ArenaDashboard}/>
<Route path='/arenas/:id' Component={ArenaDetails}/>
<Route path={['/createArena', '/manage/:id']} Component={ArenaForm} />
</Routes>
</Container>
</>
);
2
Answers
I found how to do it:
You may explicitly define it as: