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

296
Views
How to separate the logic of a functional component in react?

My functional components are very long. I would like to separate the functions in files like these:

components/header/index.js // export
components/header/header.jsx // logic
components/header/style.scss // styles
components/header/header.test.js // test
components/header/useHeader.js // hooks

I am learning. Any basic advice is welcome.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Well, there are quite a few ways now to structure your files and repo so the codebase looks good and neat but in my opinion, it is best to go with a generic to a modular approach which simply means to put related stuff together under one folder and in the way they sync up with your app and tells other devs what's going on in the repo. EX :

src --
    components -- 
               common --
                  header --
                         header.js
                         header.css
                  footer --
                  etc ..
pages --
      Home --
           Home.js
           Home.css
utils --
services --
configs --
hooks --
store --

So with this structure, it quickly tells any dev where to look for a particular thing and inside them you can structure them according to your repo and naming conventions.

about 4 years ago · Juan Pablo Isaza Report
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!