I couldn't find any information why this render is called twice ?
const Test: React.FC = () => {
const [myState, setMyState] = useState();
console.log("RENDER TEST");
return <div>test</div>;
};
When I remove
const [myState, setMyState] = useState();
then the component is rendered only once.
The same happens with useEffect:
const Test: React.FC = () => {
useEffect(() => {
console.log("Component mounted");
}, []);
console.log("RENDER TEST");
return <div>test</div>;
};
Without useEffect the render is called only once.