In React Router v5, we could provide a 404 response code in this way :
<Route path="*" component={NoMatch} status={404}/>
But how can we do it with React Router v6?
In React Router v5, we could provide a 404 response code in this way :
<Route path="*" component={NoMatch} status={404}/>
But how can we do it with React Router v6?
The react-router-dom v5 Route components don't have a status prop, and neither do the v6 Route components. If this is simply passing the status prop through to the routed component then in RRDv6 you can pass it directly to the NoMatch component as a prop.
<Route
path="*"
element={<NoMatch status={404} />}
/>