I am learning react and in particular I am studying useEffect; i am not able to understand why as soon as i run the code the console log is printed twice even if useEffect is not called.
export default function Counter() {
const [count, setCount] = useState(0);
useEffect(() => {
console.log("test");
}, [count]);
return (
<>
<button onClick={() => setCount(count + 1)}>+</button>
<p>Add: {count}</p>
</>
);
}
Thanks to those who will help me!