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

182
Visualizações
Integrated component for user and non-user or 2 separate components?

My App/website will have the same components for registered users and and non-registered users. Except that they behave a little differently.

What is the industry standard way to design this?

To create 2 separate components? Or to create 1 integrated component?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If the components is not drastically changes than i suggest keeping the same components as change their click functionally accordingly though a if statement.

const [comment, updateComment] = useState("")
const isLogin = false // should come from some global state managment(ex : redux)
handleClick = () => {
    if (isLogin) {
        // Post a comment
    } else {
        // Redirect to login page
    }
}

return <div>
    <input type="text" value={comment} onChange={e => updateComment(e.target.value)} />
    <button onClick={handleClick}> Post a comment</button>
</div>;

}

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