Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

308
Views
create-react-app: Automatically Route Based on Files In Directory

How can I modify create-react-app so that routes are automatically created for react components in a directory?

For instance, my src directory looks like this:

├── App.css
├── App.js
├── App.test.js
├── index.css
├── index.js
├── logo.svg
├── reportWebVitals.js
└── setupTests.js

I would like to modify it so that I a pages directory like this:

├── App.css
├── App.js
├── App.test.js
├── index.css
├── index.js
├── logo.svg
├── pages
│   ├── about.js
│   └── contact.js
├── reportWebVitals.js
└── setupTests.js

Then, without doing any extra manual adding of routes, I could visit localhost:3000/about and localhost:3000/contact and see the components rendered on those pages. I don't care if I have to do one time setup to get this working, but I do not want to modify any files other than the page itself whenever I add a new page.

I discovered this page but this relies on some Vite-specific things and I would prefer to continue using create-react-app.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!