Skip to content

Commit

Permalink
Make it a bit clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto authored Mar 24, 2020
1 parent c7c263a commit 4519b1d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/CreateEdit.md
Original file line number Diff line number Diff line change
Expand Up @@ -883,10 +883,10 @@ Here are the props received by the `Toolbar` component when passed as the `toolb
**Tip**: To alter the form values before submitting, you should use the `handleSubmit` prop. See [Altering the Form Values before Submitting](#altering-the-form-values-before-submitting) for more information and examples.
**Tip** If your `<Toolbar>` contains `<CreateButton>` the injection of `handleSubmit` `handleSubmitWithRedirect` `onSave` `invalid` `pristine` `saving` `submitOnEnter` props from the `<Toolbar>` will cause React warnings. You'll need to wrap `<CreateButton>` in another component and ignore the injected props, as follows:
**Tip**: If you want to include a `<CreateButton>` in the `<Toolbar>`, the props injected by `<Toolbar>` to its children (`handleSubmit`, `handleSubmitWithRedirect`, `onSave`, `invalid`, `pristine`, `saving`, and `submitOnEnter`) will cause React warnings. You'll need to wrap `<CreateButton>` in another component and ignore the injected props, as follows:
```jsx
export const ToolbarCreateButton = ({
const ToolbarCreateButton = ({
handleSubmit,
handleSubmitWithRedirect,
onSave,
Expand All @@ -896,6 +896,12 @@ export const ToolbarCreateButton = ({
submitOnEnter,
...rest
}) => <CreateButton {...rest} />;

const PostEditToolbar = props => (
<Toolbar {...props} >
<ToolbarCreateButton />
</Toolbar>
);
```
## Customizing The Form Layout
Expand Down

0 comments on commit 4519b1d

Please sign in to comment.