Skip to content

Infinite loop with onInput #9

@mahdix

Description

@mahdix

I'm using latest version (2.0.7). Looks like if I change a non-trivial state inside onInput handler, it causes infinite calls to the handler:

image

I simply modified the original codesandbox: url

Basically, my change is like:

  onInput={(e) => {
          setV({ ...v, min: e.minValue, max: e.maxValue });
          console.log("onInput called");
        }}

and it causes the loop;

If I use two separate state variables, everything works fine.

setMin(e.minValue);
setMax(e.maxValue);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions