Organizing pages with react router #320
Comments
Hey, with Gatsby, the React Router routing config is automatically created. You don't need to manually create routes and in fact can't (currently). Look at the starters — none of them have routes setup. Routes are created from the position of a file. So if you have a file at |
This is interesting. I am curious to know why you use react-router to make a file to url mapping. On the opposite, Phenomic currently allow you to use your own routes (and there is even a WIP to generate all routes like /tag/:tag, based on front matter tags for example). |
@KyleAMathews Thanks for the response. So, if I understand correctly Fig 1 and Fig 2 are equivalent? Fig 1
Fig 2
@MoOx No particular reason but I want more control of routing rather than depending on the convention. I'll checkout Phenomic. Thanks! |
@KyleAMathews Currently Phenomic rely on a splat parameter to catch all routes and the mapping is done into the component that handle the data fetching (Phenomic does not put all content in the bundle by default).
|
How are we able to do routing with components then ? Do we precisely have to use pages folder or is it possible to tweak it somehow? |
Yes, just add components or other supported file types to the pages directory and they'll become pages. A new API was also just added a few days ago that let's you modify the autogenerated routes #657 |
@KyleAMathews that's a huge problem with Gatsby. We need more control with React |
How are we able to add user JWT authentication without routing? If we have multiple users and go to www.mysite.com/dashboard and /dashboard is a protected route we can do this using React and Express but it can't be done with Gatsby/Netlify? |
Hi, I want to organize pages using react router e.g.,
The problem is build fails because
browserHistory
can't be used on the server. How can I accomplish the goal?BTW thanks for the awesome project!
The text was updated successfully, but these errors were encountered: