Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

297
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda