Skip to content

input.onChange has a new reference each time value changes #816

@adrienharnay

Description

@adrienharnay

Are you submitting a bug report or a feature request?

Bug report

What is the current behavior?

Every time a field value changes, onChange gets a new reference (and maybe other event handlers do as well).

What is the expected behavior?

When building a custom field and using useEffect, it's frequent to depend on onChange to update a value. In my case for a large field, I use useMemo to make sure I only rerender the parts that need it, but onChange makes sure everything gets updated every time the value changes. Is there another way than useCallback(input.onChange, [])?

Sandbox Link

https://codesandbox.io/s/react-final-form-third-party-components-example-lo4yo?file=/index.js

What's your environment?

(Latest on every lib, as seen on the sandbox)

Other information

/

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions