DEV Community

Alex Blinov
Alex Blinov

Posted on • Originally published at


Custom onChange in React Final Form

Let's take a case when we need to call our own function to change a state of a specific field in a form (our react final form).

Here is a way to do the exact that:
You should pass your function as a parameter and after that just call it inside of the onChange method


const FormGroupAdapter = ({ input, inputOnChange }) => {
    const inputProps = {
        onChange: e => {
            inputOnChange && inputOnChange(e);

    return <input {...inputProps} />;

const handleChange = event => {

const App = () => (
        render={({ handleSubmit, reset, submitting, pristine, values }) => (
            <form onSubmit={handleSubmit}>
                    <label>some label</label>

Live example

Oldest comments (0)

The most important JavaScript discussions happen on DEV

React vs Signals: 10 Years Later

React vs Signals: A Look Back

☝️ Ryan Carniato and Dan Abramov take a look back at React!