I like to create a component that contains ColorPicker and I like to pass the gradient object to the upper component.
getGradientObject not returning the correct object coz color not updated with value yet. this happens for value to hex too.
like this
const [color, setColor] = useState('rgba(70,70,142,1)');
const { getGradientObject, valueToHex } = useColorPicker(color, setColor);
function onChange(value: string) {
setColor(value);
if (props.onChange) {
const g = getGradientObject();
props.onChange(value, g.isGradient ? g : undefined);
}
}
I like to create a component that contains ColorPicker and I like to pass the gradient object to the upper component. getGradientObject not returning the correct object coz color not updated with value yet. this happens for value to hex too. like this