reduxjs / redux-toolkit

The official, opinionated, batteries-included toolset for efficient Redux development
https://redux-toolkit.js.org
MIT License
10.62k stars 1.15k forks source link

Updating examples using react-router-dom v6 #2134

Open mert-duzgun opened 2 years ago

mert-duzgun commented 2 years ago

Hi,

I've searched through all issues (including closed ones) and couldn't find anything about this topic. I love using RTK and RTK Query and I think the examples section is great. But they're still using react-router-dom v5. Since I recommend this library to several people, this situation is a little bump in the road according to feedbacks I receive. I would love to update all the examples using react-router-dom v6 if there's no planned action on that topic.

Thanks.

phryneas commented 2 years ago

I mean, of course PRs against the examples are always welcome - but is that in any way really relevant on how to use RTK Query?

mert-duzgun commented 2 years ago

Not really. Actullay, RTK Query examples are so good for learning concepts like authentication. But react router has changed a lot and some people are getting frustrated while they try to build their own apps using RTK Query via following examples. What I'm trying to say is, it could be better for beginners since they won't have to figure out routing on their own. That's not a crucial thing, it targets beginners mostly. I just want to contribute to this awesome library and thats one thing I think I can do.

markerikson commented 2 years ago

Yeah, as Lenz said, PRs are definitely welcome. I am curious - got any pointers to where "people getting frustrated", as far as discussion?

mert-duzgun commented 2 years ago

For example, the PrivateRoute.tsx component doesn't work with v6. I know the equivalent methods are written in react-router docs but this means an extra step for a person who wants to implement basic auth for instance. Maybe the term 'frustrated' is a little bit too much :)

pauljosephatay commented 1 year ago

and the new react router v6 data api aka loader too

markerikson commented 1 year ago

@pauljosephatay : see discussion of RTK + the React-Router loaders in https://github.com/reduxjs/redux-toolkit/discussions/2751 .

To be frank, we don't have time or energy to update the routing examples ourselves. We'd happily accept PRs that improve things!

pauljosephatay commented 1 year ago

Thanks a ton @markerikson for the link!

seanmcquaid commented 1 year ago

Any objection from anyone if I work on a PR for this issue?

markerikson commented 1 year ago

@seanmcquaid : please, go for it!