Skip to content

useField pass a validate function will cause Infinite loops #44

Closed
@chenjigeng

Description

@chenjigeng

Are you submitting a bug report or a feature request?

bug report

Sandbox Link

https://codesandbox.io/s/m38k650n79

See the console.

Other information

I see the source code of useField and find the reason.
image
In react function, every render will product new validate function.So it will cause this problem. Although we can use useCallback to avoid it.But it's so hard to use for user.Can we use useCallback in the inner or something else to solve this.

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