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

228
Visualizações
is it okay to use a custom Hook for every functionality? or should I keep the use of hooks in my project to a minimum?

as of now, I am making a ReactJs web application that is a chatroom using Firebase i have created a dedicated hook for each functionality for example, there are hooks like

  • useSignup
  • useLogin
  • useLogout
  • useAuth
  • useCollection
  • useSendMsg

that return a function that performs the tasks indicated by the name of those custom hooks, using hooks for these look attractive to be because it allows me to return state checkers like isLoading and isError along with their functions, those are simple useStates that i set during the process to manage the loading and error states.

there are other hooks I create that are related to context, i like to call contexts inside hooks because that way the code looks a lot more elegant and de-cluttered for example i created hooks like

  • useAuthContext
  • useCurrentRoomContext

I am not over-doing it am I? I was curious about were do I draw the line? is it healthy to use Hooks like this? should I change my Programming approach?

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