Skip to content
Advertisement

Tag: react-state

Why .then() which is in useEffect is not updating my state

targetMovie is null when it comes to rednering. I couldn’t find any solutions. First time having unsolvable problem. Please help! Answer You need to represent 3 states: You’re currently waiting on getMovie to complete getMovie completed successfully getMovie completed and returned null/undefined You’re currently using the same condition (!targetMovie) to represent both 1. and 3. which is why you’re running

More elegant way of checking all state values

Is there a more elegant way of checking all state variables in my react app ? I currently have 14 state variables within my app, I am checking the value of each and updating to an empty string if they do not pass validation (left empty) code is as: This does work, so its not the end of the world,

Advertisement