Skip to content

Commit

Permalink
UPGRADE doc
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienMattiussi committed Mar 2, 2020
1 parent 534a24c commit 9ab6523
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ The migration to `react-final-form` changes their signature and behavior to the
- `handleSubmit`: accepts no arguments, and will submit the form with its current values immediately
- `handleSubmitWithRedirect` accepts a custom redirect, and will submit the form with its current values immediately

Attention, react-final-form doesn't split form validation and form submission.
If you want `handleSubmit` and `handleSubmitWithRedirect`

Here's how to migrate the _Altering the Form Values before Submitting_ example from the documentation, in two variants:

1. Using the `react-final-form` hook API to send change events
Expand Down Expand Up @@ -154,6 +151,11 @@ const SaveWithNoteButton = ({

2. Using react-admin hooks to run custom mutations

Caution, react-final-form doesn't split form validation and form submission.
If you want to overload the submission but to keep the validation, don't use `handleSubmit` or `handleSubmitWithRedirect` but use instead `onSave`.

- `onSave` have two props, the form values to save and the redirection to perform.

For instance, in the `simple` example:

```jsx
Expand Down

0 comments on commit 9ab6523

Please sign in to comment.