Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

306
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda