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

119
Visualizações
JavaScript React export const inside a exported function

Folks, I am trying export de const 'valor' to other file to be used there. The return ([render things, valor]) not work for me because it render the 'valor' toguether with the render part when i call .

How can i get the value exported without trouble the render return tag?

interface Free_or_premi_Props{
  Only_Free?: boolean;
  Only_Premi?: boolean;
 }

const BotaoFreePremi = ({Only_Free, Only_Premi}: Free_or_premi_Props) => {

  const [valor, setvalor] = Only_Premi? useState(1) : useState(0); 
  function CliqueFree() {
    setvalor(0);
  }
  function CliquePremi() {
    setvalor(1);
  }
  return (
    <Box textAlign={"center"}>
      <ButtonGroup color="primary">
        <BotaoFreePremiSwitcher
         disabled={Only_Premi ? true : false}
          value={valor}
          onClick={CliqueFree}
          variant={valor == 0 ? "contained" : "outlined"}
        >
          Free
        </BotaoFreePremiSwitcher>
        <BotaoFreePremiSwitcher
          disabled={Only_Free? true : false}
          value={valor}
          onClick={CliquePremi}
          variant={valor == 1 ? "contained" : "outlined"}
        >
          Premi
        </BotaoFreePremiSwitcher>
      </ButtonGroup>
    </Box>
  );
};
export default BotaoFreePremi;
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