Relative Content

Tag Archive for javascriptreactjsuser-interface

React useState value is not updating the value in initial render

whenever I update value of usestate boolean in child component via setter method passed from parent , the value not getting updated in parent and child too on initial render,
tried to reproduce the same problem in codesandbox but surprisingly same code snippet is working here but not in my project, any idea why this happening and behaviour not consistent in code sandbox environment and in my machine , tried to fix via useEffect but that also didn’t works, any suggestions, ideas, or explanations here are much appreciated
code sandbox link for problem