Skip to content
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

Project structure: the routes folder #90

Open
mauro-ni opened this issue Aug 29, 2022 · 2 comments
Open

Project structure: the routes folder #90

mauro-ni opened this issue Aug 29, 2022 · 2 comments

Comments

@mauro-ni
Copy link

Could you please explain what to put under routes folder?
Do I have to put the mapping Component <=> Url or the components using react-router?

Many thanks in advance for your help.

Mauro

@CodeNameGrant
Copy link

@mauro-ni , From the description and the example code, you would place the react-router Routes and the components they should render.
src/routes is responsible for handle root level routes, use this to navigate to your features, like /discussions/* renders the <DiscussionsRoutes /> component
src/features/discussions/routes is responsible for handling any routes after that.

Meaning that the root level routes will navigate to your feature, but then your feature will handle any routing with in it.

I hope that helps.
-G

@mauro-ni
Copy link
Author

mauro-ni commented Sep 2, 2022

@CodeNameGrant many thanks for your reply.
If you give a look at Discussions feature you see that the folder also contains Discussion.tsx and Discussion.tsx. I prefer leaving these components in the feature compontents directory.

What do you think?

Many thanks,
Mauro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants