alan2207 / bulletproof-react

🛡️ ⚛️ A simple, scalable, and powerful architecture for building production ready React applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project structure: the routes folder

mauro-ni opened this issue · comments

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

@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

@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