diff --git a/README.md b/README.md index 1aa0748c..f91e9f08 100644 --- a/README.md +++ b/README.md @@ -14,16 +14,16 @@ As an abstraction, this tool allows for greater consistency and maintainability - [Global Configuration](#global-configuration) - [`RestfulProvider` API](#restfulprovider-api) - [Composability](#composability) - - [`Get` full API](#get-full-api) + - [`Get` Component API](#get-component-api) - [Loading and Error States](#loading-and-error-states) - [Lazy Fetching](#lazy-fetching) - [Response Resolution](#response-resolution) - [TypeScript Integration](#typescript-integration) - [Mutations with `Mutate`](#mutations-with-mutate) - - [`Mutate` API](#mutate-api) + - [`Mutate` Component API](#mutate-component-api) - [Polling with `Poll`](#polling-with-poll) - [Long Polling](#long-polling) - - [`Poll` API](#poll-api) + - [`Poll` Component API](#poll-component-api) - [Caching](#caching) - [Contributing](#contributing) - [Code](#code) @@ -169,48 +169,7 @@ From the above example, _not only_ does the path accumulate based on the nesting To opt-out of this behavior `Get` components can use an alternative URL as their `base` prop. -#### `Get` full API - -```ts -interface Get { - /** - * The path at which to request data, - * typically composed by parent Gets or the RestfulProvider. - */ - path: string; - /** Options passed into the fetch call. */ - requestOptions?: RestfulReactProviderProps["requestOptions"]; - /** - * A function to resolve data return from the backend, most typically - * used when the backend response needs to be adapted in some way. - */ - resolve?: (dataFromBackend: any) => TData; - /** - * Should we wait until we have data before rendering? - * This is useful in cases where data is available too quickly - * to display a spinner or some type of loading state. - */ - wait?: boolean; - /** - * Should we fetch data at a later stage? - */ - lazy?: boolean; - /** - * An escape hatch and an alternative to `path` when you'd like - * to fetch from an entirely different URL. - * - */ - base?: string; - /** - * A function that recieves the returned, resolved - * data. - * - * @param data - data returned from the request. - * @param actions - a key/value map of HTTP verbs, aliasing destroy to DELETE. - */ - children: (data: TData | null, states: States, actions: Actions, meta: Meta) => React.ReactNode; -} -``` +#### [`Get` Component API](src/Get.tsx) ### Loading and Error States @@ -328,9 +287,9 @@ const Movies = ({ dispatch }) => ( movies.map(movie => (
  • {movie.name} - + {(delete, {loading: isDeleting}) => (