-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QUESTION: Why didn't you use React Router #5
Comments
Hi, thanks a lot for your question) First of I have to say, React Router is a great project. But there several problems. Or there were several problems, cause now it has version number six. But the last time, when I was looking on it — it was 5 alpha or something) So, problems.
Let's imagine you have such Route: <Route path="/user/:id" element={<User />}> If you follows the docs of React router, you have to do something like this to get that function User() {
const params = useParams();
const userId = params.id;
...
} But, you have no idea, if Yeah, v6 has In my project you have quite strong types (https://github.com/artem-malko/react-ssr-template/blob/main/src/application/pages/shared.ts#L44C3-L46C3) You just can not apply And it was just one example of type problem)
Actually, it is not bad idea, but IMHO quite strange limitation. I can't understand the idea, that every Route can have only one source of data. Especially when we have suspense and react-query, which works pretty ok with it.
To open another page by using imperative API like
It's not so important, but just a nice bonus) Actually, I'd like to discuss it, if you have an experience with React Router, especially with v6. |
Oh, I forgot about one important thing. React Router v5 doesn't support renderToPipepableStream. It was a huge blocker for me |
I actually haven't had any experience with React Router v6. Currently, I'm working on a legacy project and essentially rewriting it. Since it's going to be a large and complex project, it sometimes makes more sense to lean on reliable packages. However, I haven't had the chance to dive deep into the structure of this template, so I wanted to ask you about your preferences :) It's good to learn that v5 doesn't support renderToPipeableStream, which is beneficial for me. I was considering using v6 in the new project. I think it would make sense to do some research and conduct some experiments here. Thank you very much for your response |
@ahmetkuslular I have to correct myself, v5 had some problems with renderToPipeableStream on the alpha stage) May be they've done something and now it works) But other points are still valid, even for v6. But, React Router has a big advantage — the community, which can help you with problems and questions. |
Why didn't you use React Router? This is the first time I've seen a React project without React Router. 😅
The text was updated successfully, but these errors were encountered: