Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

121
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!