Skip to content

Commit

Permalink
Merge pull request #7628 from marmelab/fix-edit-record-doc
Browse files Browse the repository at this point in the history
[Doc] Fix Edit component mentions unsupported prop
  • Loading branch information
slax57 authored May 4, 2022
2 parents df1d9c1 + 95bbeee commit 03a0980
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions docs/Edit.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ You can customize the `<Edit>` component using the following props:
* [`mutationMode`](#mutationmode): switch to optimistic or pessimistic mutations (undoable by default)
* [`mutationOptions`](#mutationoptions): options for the `dataProvider.update()` call
* [`queryOptions`](#queryoptions): options for the `dataProvider.getOne()` call
* [`record`](#record): use the provided record as base instead of fetching it
* [`redirect`](#redirect): change the redirect location after successful creation
* [`resource`](#resource): override the name of the resource to create
* [`sx`](#sx-css-api): Override the styles
Expand Down Expand Up @@ -402,24 +401,6 @@ const PostEdit = () => (

Refer to the [useQuery documentation](https://react-query.tanstack.com/reference/useQuery) in the react-query website for a list of the possible options.

## `record`

On mount, the `<Edit>` component will fetch the record to edit using the `resource` and the `id` from the URL. You can also use `<Edit>` independently of the URL, by passing a record directly via the `record` prop.

{% raw %}
```jsx
const PostEdit = () => (
<Edit record={{ id: 123, title: 'Hello' }}>
<SimpleForm>
...
</SimpleForm>
</Edit>
);
```
{% endraw %}

This is useful when you want to embed an edition view in another view, for instance when displaying the edit form in a dialog.

## `redirect`

By default, submitting the form in the `<Edit>` view redirects to the `<List>` view.
Expand Down

0 comments on commit 03a0980

Please sign in to comment.