How to fix React Hook "useState" is called conditionally in React | DevErrors