React useState hook always comes as undefined when setting it in useEffect
In my React application, I have a useEffect that checks if an element has the display style none set to it. If it does then it should set the state to false, however it always comes back as undefined. const [testingProp, setTestingProp] = useState(); useEffect(() => { const styles = getComputedStyle(customerPropertyTypeSection.current); if (styles.display == ‘none’)… Read More React useState hook always comes as undefined when setting it in useEffect