N
N
n1ksON2020-11-28 23:37:55
React
n1ksON, 2020-11-28 23:37:55

How to fire an event after the mouse button is released in React?

It is necessary that the event fires after the mouse button is first pressed and then released. That is, the mouseup event should fire. But how do you make this event fit the React philosophy?

UPD:
App.js:

const App = ({ color }) => {
  const colorRef = useRef(color)
  const record = (base) => {
    // обновляется state
  }
  return (
    <input type="color" ref={colorRef} defaultValue={color} onMouseUp={record} />
  )
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iBird Rose, 2020-11-29
@n1ksON

https://ru.reactjs.org/docs/events.html#mouse-events

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question