Ad

How To Create My Own OnChangeComplete Function For Input Type Color On React

- 1 answer

With react-color https://casesandberg.github.io/react-color/ .
I can use ready-made onChangeComplete function from react-color.

But I wonder how can I create that onChangeComplete by using input type color tag. I tried onBlur but the color won't change until user clicks or presses tab

On the other hand, using onChange keep firing updates.
Because currently I'm using redux state, so dispatching update continuously when I drag and choose color isn't a good way.

Any ideas how to create onChangeComplete?

Ad

Answer

https://github.com/casesandberg/react-color/blob/7ee60d845e5d5e11e4f6ecb895b2d9755c59d09d/src/components/common/ColorWrap.js#L30

Here is the code that how react-color implemented onChangeComplete. It is hard coded using debounce. I put the link there for anyone interested in using that solution

Ad
source: stackoverflow.com
Ad