Relative Content

Tag Archive for reactjstypescriptreact-hooks

React state not being changed properly when passed to child

fairly simple issue here that I cannot seem to fix. My understanding and previous practice of using react is if you want to change a state from a parent within a child, it should be passed to the child. Upon clicking on the main “Project” div, the state gets changed to ‘true’ and the modal appears, but when attempting to press the ‘X’ within ‘ProjectModal’, the state does not change to false, thus not closing the modal.
What am i missing here? i’ve done with numerous times before yet i cannot fix this issue.

React state not being changed properly when passed to child

fairly simple issue here that I cannot seem to fix. My understanding and previous practice of using react is if you want to change a state from a parent within a child, it should be passed to the child. Upon clicking on the main “Project” div, the state gets changed to ‘true’ and the modal appears, but when attempting to press the ‘X’ within ‘ProjectModal’, the state does not change to false, thus not closing the modal.
What am i missing here? i’ve done with numerous times before yet i cannot fix this issue.