diff --git a/docs/resources/creation.md b/docs/resources/creation.md index 06775cc3..c266d344 100644 --- a/docs/resources/creation.md +++ b/docs/resources/creation.md @@ -17,9 +17,9 @@ export const userProfileResource = createResource({ | Property | type | Description | | --------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `type` | `string` | Used as a namespace for this resource. Each resource should have a unique type | -| `getKey` | `(routerContext, customContext) => string` | The return value of this function is used to identify this resource within the `type` namespace. The function itself is supplied with `routerContext` and `customContext` so that the composition of keys can use this data if required | -| `getData` | `(routerExtendedContext, customContext) => Promise` | This function is used to load the data for the resource. The function should return a promise and resolve with the resource data object. NOTE: You may not use `getData` and `getDataLoader` on the same resource | +| `getKey` | `(routerContext, customContext) => string` | The return value of this function is used to identify this resource within the `type` namespace. The function itself is supplied with `routerContext` and `customContext` so that the composition of keys can use this data if required. `customContext` comes from the top level Router component and its value is equal across resources. `routerContext` contains the current route and location data, which come from the current URL or from a manually provided value (see the ["Accessing resource state for another route or url"](https://atlassian-labs.github.io/react-resource-router/#/resources/usage?id=accessing-resource-state-for-another-route-or-url) section). The router will fetch and cache data for that route then. | +| `getData` | `(routerExtendedContext, customContext) => Promise` | This function is used to load the data for the resource. It is called when initial fetch or `refresh()` is called on the resourse. The function should return a promise and resolve with the resource data object. NOTE: You may not use `getData` and `getDataLoader` on the same resource. | | `maxAge` | `number` | How long (in milliseconds) the resource should be kept in the router before a fresh resource is retrieved. Note: resources are only refreshed on route _change_. The router does not poll or update resources in the background. Navigation within the same route, e.g. query param change, will not trigger a refresh of resources. | | `maxCache` | `number` | How many resources can be kept in the router for a particular `type`. Once the threshold limit is reached, a **Least Recently** used resource gets deleted, making space for the new requested resource of the same type. | | `getDataLoader` | `() => Promise<{default: getData}>` | Optional property that enables neater code splitting. See more below. NOTE: You may not use `getData` and `getDataLoader` on the same resource -| `isBrowserOnly` | `boolean` | Optional property that skips fetching the resource on server. The default value is false. | \ No newline at end of file +| `isBrowserOnly` | `boolean` | Optional property that skips fetching the resource on server. The default value is false. |