Skip to content

Commit 2f655d4

Browse files
committed
use context instead of controllerContext
1 parent 8c95570 commit 2f655d4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

docs/ReferenceManyFieldBase.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const BookList = ({
4141
}: {
4242
source: string;
4343
}) => {
44-
const context = useListController();
44+
const context = useListContext();
4545

4646
if (context.isPending) {
4747
return <p>Loading...</p>;

docs/ReferenceOneFieldBase.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const BookShow = () => (
4646

4747
// with BookDetails something like
4848
const BookDetails = ({ source }) => {
49-
const context = useReferenceOneFieldContext({
49+
const context = useReferenceFieldContext({
5050
reference,
5151
target,
5252
});
@@ -76,7 +76,7 @@ const BookDetails = ({ source }) => {
7676
| `reference` | Required | `string` | - | The name of the resource for the referenced records, e.g. 'book_details' |
7777
| `target` | Required | string | - | Target field carrying the relationship on the referenced resource, e.g. 'book_id' |
7878
| `children` | Optional\* | `Element` | - | React component to render the referenced record. |
79-
| `render` | Optional\* | `(referenceFieldContext) => Element` | - | A function that takes the reference field context and return a React element |
79+
| `render` | Optional\* | `(ReferenceFieldContext) => Element` | - | A function that takes the `ReferenceFieldContext` and return a React element |
8080
| `empty` | Optional | `ReactNode` | - | The text or element to display when the referenced record is empty |
8181
| `filter` | Optional | `Object` | `{}` | Used to filter referenced records |
8282
| `link` | Optional | `string | Function` | `edit` | Target of the link wrapping the rendered child. Set to `false` to disable the link. |
@@ -90,11 +90,11 @@ const BookDetails = ({ source }) => {
9090
## `children`
9191

9292
You can pass any component of your own as children, to render the referenced record as you wish.
93-
You can access the list context using the `useReferenceOneFieldController` hook.
93+
You can access the list context using the `useReferenceFieldContext` hook.
9494

9595
```jsx
9696
const BookDetails = () => {
97-
const { isPending, error, referenceRecord } = useReferenceOneFieldContext({
97+
const { isPending, error, referenceRecord } = useReferenceFieldContext({
9898
reference,
9999
target,
100100
});

0 commit comments

Comments
 (0)