botão de alternância valor react
import { Switch } from '@chakra-ui/react';
const defaultSwitchValue = true;
const [sameAddressSwitch, setSameAddressSwitch] = useState(defaultSwitchValue);
const handleSwitchOnChange = () => {
const newValue = !sameAddressSwitch;
setSameAddressSwitch(newValue);
};
return (
<Switch
colorScheme='blue'
size='md'
defaultChecked={defaultSwitchValue}
onChange={handleSwitchOnChange}
/>
);
Grumpy Goat