Consider deprecating this in favor of @reach/component-component
See original GitHub issueFirst of all, thanks again for the amazing work on formik
, I’ve recently upgraded it from 0.* to 1.3 without breaking changes 😲!
I think this package brings not so much value considering more generic alternatives, like: https://ui.reach.tech/component-component
I propose to deprecate this redirecting the new users to the alternatives!
Comparison
// withFormikEffect.js
import React from 'react'
import ReactDOM from 'react-dom'
import {Formik, Form, Field} from 'formik'
import {Effect} from 'formik-effect'
const App = () => (
<div>
<h1>Formik with formik-effect</h1>
<Formik onSubmit={console.log} initialValues={{nickname: '', password: ''}}>
{formik => (
<Form>
<Effect
onChange={(currentFormik, nextFormik) =>
console.log(currentFormik, nextFormik)
}
/>
<Field name="nickname" />
<Field name="password" />
<input type="submit" />
</Form>
)}
</Formik>
</div>
)
const rootElement = document.getElementById('root')
ReactDOM.render(<App />, rootElement)
vs
// withComponentComponent.js
import React from 'react'
import ReactDOM from 'react-dom'
import {Formik, Form, Field} from 'formik'
import Component from '@reach/component-component'
const App = () => (
<div>
<h1>Formik with formik-effect</h1>
<Formik onSubmit={console.log} initialValues={{nickname: '', password: ''}}>
{formik => (
<Form>
<Component
formik={formik}
didUpdate={({prevProps, props}) => {
console.log(prevProps.formik, props.formik)
}}
/>
<Field name="nickname" />
<Field name="password" />
<input type="submit" />
</Form>
)}
</Formik>
</div>
)
const rootElement = document.getElementById('root')
ReactDOM.render(<App />, rootElement)
The difference is minimal and u can do it in other ways also (for example passing only the formikBag props you want to Component
)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:8
Top Results From Across the Web
React.Component
We strongly recommend against creating your own base component classes. In React components, code reuse is primarily achieved through composition rather ...
Read more >React 16.9 Deprecation *Will* warning · Issue #1374 - GitHub
React throw a warning about all deprecated WILL methods inside react-redux. ... What is the expected behavior? As long as React works on...
Read more >Will React Classes Get Deprecated Because of Hooks?
Before you say anything, yes, I am aware that React's official documentation states that there are no plans to deprecate class components ......
Read more >ReactDOM.render is no longer supported in React 18 - Stack ...
react-dom : ReactDOM.render has been deprecated. Using it will warn and run your app in React 17 mode. react-dom : ReactDOM.hydrate ...
Read more >Why You Should Probably Think Twice About Using React.FC
FC can introduce problems to your components and an alternative you can ... it will eventually be deprecated in favor of the naming...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cloud-walker Yeah exactly. Got it now - thanks! 🙇
Kind of an edge case to submit a form on a field change but in our real app we have a select field that when changed will make a REST call to filter the grid contents. I think it’s a better experience to submit the form on change rather than making them select then hit a button. The sandbox is a dumb example but did show what was going on.
Jared pointed me in a right direction and for this I’m not using Component-Component. There are some places where we need to update a field based on a value from another field so I want to try C-C there. Here is my solution for submitting on a select field change.
https://github.com/jaredpalmer/formik/issues/1209#issuecomment-450027026