Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function RooksDemo() {
const [hasMagicStarted, setHasMagicStarted] = useToggle(false);
const [toggle1, setToggle1] = useToggle(false);
const { value: counter, increment } = useCounter(5);
const { start, stop } = useInterval(() => {
setToggle1();
increment();
}, 100);
useEffect(() => {
if (hasMagicStarted) {
start();
} else {
stop();
}
}, [hasMagicStarted]);