I need to triger child function inside parent component? I am using React
Parent component ->
selectedColors = (colors) => {
// need to props colors and trigger child function.
};
<Field
id="primary-color"
name="theme.primaryColor"
component={ButtonColorPicker}
/>
Child component is ButtonColorPicker
ButtonColorPicker component ->
handleChange = (color) => {
console.log("here i need props value from PARENT", color);
this.props.input.onChange(color.hex);
};
<SketchPicker color={input.value} onChange={this.handleChange} />
import { SketchPicker } from "react-color";
SketchPicker is just plugin for changing colors.
I need from parent component to trigger handleChange function.