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;