1. 6
  1.  

  2. 1

    If you prefer to abstract this away, there is a useAPI hook. https://github.com/ABWalters/react-api-hooks