Readme Custom Hooks
===
The UI library can interact with ReadMe's internal APIs via a [custom hook](https://reactjs.org/docs/hooks-custom.html), `useReadmeApi`! The hook acts as an easy wrapper for [Mozilla's Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). That means, any payload you pass it should be structured similarly! The hook should allow for easy DB/async operations consistent with React's functional approach.

#### Api Actions
To interact with Readme's internal API, you'll need pass in an options payload.

```text
const exampleGetRequest = initRequest => {
  return initRequest({
    method: 'GET',
    path: '${'Path'}',
  });
};

const examplePostRequest = (initRequest, data) => {
  return initRequest({
    method: 'POST',
    path: '${'Path'}/${key}',
    body: JSON.stringify(data),
  });
};

export { exampleGetRequest, examplePostRequest };
```

#### Hook Usage
Interacting with the hook is straightforward. The hook takes a `baseUrl` arg, and produces a destructured response with the following variables: `data`, `pendingFetch`, and `initRequest`.
- `data`: Response payload to consume and apply to components
- `pendingFetch`: Do we need to submit a follow-up get request to retrieve our database's state?
- `initRequest`: Initialize a new request with an `options` arguement

```text
export default function ExampleComponent ({...props}) {
  import React, { useState, useEffect } from 'React';
  import * as ApiActions from './apiActions';
  import useReadmeApi from '@core/hooks/useReadmeApi';

  const [state, setState] = useState(null);
  const [data, pendingFetch, initRequest] = useReadmeApi(baseUrl);


  useEffect(() => {
    if (data) {
      setState(data);
    }
  }, [data]);

  useEffect(() => {
    if (pendingFetch) {
        ApiActions.exampleGetRequest(initRequest);
    }
  }, [pendingFetch]);

  const handler = (data) => {
    ApiActions.examplePostRequest(initRequest, data);
  };
};
```
