One of the key things to use Functional Component is and
useEffect - https://reactjs.org/docs/hooks-effect.html
useState - https://reactjs.org/docs/hooks-state.html
Below is an example of how you can use them with your API call using Axios or Fetch.
Using an example, you can see of how Single Exception is being used. To view how it works, you will need to click "Open on Replit" and press Run
You may also want to read up the differences between functional and class components in React.
Comentários