DEV Community

loading...

Discussion on: In React, component controls you!

Collapse
0916dhkim profile image
Donghyeon Kim

What about this?

  const onUp = () => setValue(value + 1);
  const onDown = () => setValue(value - 1);
  const onInputChange = (e, next) => setValue(next);

  useEffect(() => {
    onChange?.(createEvent(internalRef.current, "change"), value);
  }, [value]);
Enter fullscreen mode Exit fullscreen mode

Did I miss something?