+ 3
[Solved] How can i change state using setState from inside a function component when setState is declared outside of it.
2 Respuestas
+ 3
You have to pass the setState function to Image_Component as a property.
return (<Image_Component setState={setState} />);
function Image_Component(props) {
props.setState(true);
}
+ 2
Thanks a lot Schindlabua