

If no subscription is provided, it will default to subscribing to all form state changes. If a subscription is provided, the will only rerender when those parts of form state change.

Will not be called if an onChange callback is specified.Īn object of the parts of FormState to subscribe to. Note that if you specify render and children, render will be called, with children injected as if it were an additional prop. (if you specify component or render or onChange)Ī render function that is given FormSpyRenderProps, as well as any non-API props passed into the component. children (props : FormRenderProps ) => React. If you do not provide an onChange callback, you must provide one of the ways to render: component, render, or children. For dirty fields, the errors are displayed immediately.These are the props that you pass to. When a field gets focus for the first time and the value is changed, the errors are displayed only after the field loses focus. There are others who participate in reviews, but the author seems to be the most active with others far behind him. Overwhelming majority of code has been written by the author. There are 201 opened issues and 61 opened PRs at the time of writing this post. Though there are suggestions for workarounds, we will not see a proper solution any time soon.Įven though array fields are supported, the errors for array fields are missing. It is not possible to validate form on initial render. I also tried a more complex form with nested fields and resetting for foreman_templates.įormik passes only onBlur and onChange handlers to the form field, while redux-form additionally has onDragStart, onDrop, onFocus So it looks like wizards are possible, I haven’t tried to create one myself. Wizard forms - there is an official example how to do a wizard form, some people even roll out their own solutions based on formik ( here and here). It should be possible to have additional abstraction with HOC, but I left things intentionally as a bare-bones example.Ĭustom components - about as difficult as with redux-form, all I needed to do was replace Field component from redux-form with the one from formik in our TextField component.Įxtensible forms - we would need to add initial state for the additional fields to the Formik component, fields themselves can be added with slot-fill I replaced redux-form with formik in bookmarks form in an attempt to figure out whether it is a viable replacement.ĭifficulty to switch - low, the changes are mostly limited to the bookmarks form itself.
