import { useEffect, useState } from 'react';
const [count, setCount] = useState(0);
const [doubled, setDoubled] = useState(0);
useEffect(() => {
setCount(1);
}, []);
useEffect(() => {
setDoubled(count * 2);
}, [count]);
useEffect(() => {
console.log(doubled);
}, [doubled]);
// OUTPUT VALUES:
// 0
// 2