How to call an API in react (using useEfffect())