why does each functionnal component in a react-component class have different behaviour?

hello if I understood your question well here is a solution to your problem https://codesandbox.io/s/crazy-wave-cj2n3?fontsize=14&hidenavigation=1&theme=dark and to explain what’s the problem in your code u are not telling the child component to re-render when the props (visible) is changed and to do that u need to pass it in the array of useEffect function if you want to understand that more uncomment the line in App component and remove visible from useEffect you will see that the state is actually permuting from true to false in the parent but not in the child

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top