DEV Community

Mustafa  Çam
Mustafa Çam

Posted on

If you think debounce or onblur is not working in React, you can check it.

Answer: If you have set up a structure to directly see the updated state in order to work with the value value in the input value, onchange, and then you have thought about the logic of debounce or onblur so that it does not render after the state change, and if you are wondering why you cannot enter a value into the input, then the value of the input value is the value of the input value. You can remove the value.

Example:

 <input
                  type="text"
                  name="example"
                  // value={example}  this is the comment line
                  onChange={handleOnchange}
                  className={`w-2/3 p-2`}
                />
Enter fullscreen mode Exit fullscreen mode

this way onblur and debounce can work.

Top comments (0)