You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I really don't like having routing information in my components and avoid it as much as possible. It entangles the component and routing information together unnecessarily and is harder to maintain.
In v5 it was possible to do:
<Route
path="/users/:id"
render={({ match }) => (
<User id={match.params.id} />
)}
/>
```
This is far more maintainable than the v6 version:
function User() {
let { id } = useParams();
// ...
}
In the v5 version the ":id" magic string is right there with the .id property. It's far easier to change. It is also possible to use this component from a different route with different parameters or at a different part of the component hierarchy where the id comes from somewhere else.
I propose allowing element to be a function. i.e.:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using
react-router
with@loop-payments/react-router-relay
which is pretty sweet but non-Relay entry points are a little ugly.I really don't like having routing information in my components and avoid it as much as possible. It entangles the component and routing information together unnecessarily and is harder to maintain.
In v5 it was possible to do:
function User() {
let { id } = useParams();
// ...
}
In the v5 version the
":id"
magic string is right there with the.id
property. It's far easier to change. It is also possible to use this component from a different route with different parameters or at a different part of the component hierarchy where the id comes from somewhere else.I propose allowing
element
to be a function. i.e.:Beta Was this translation helpful? Give feedback.
All reactions