Answer the question
In order to leave comments, you need to log in
How to correctly pass the hook function through props to the child component?
I want to pass the setIsEditinf function via props from the parent component to the child component, but in the process I get a bunch of errors that I can't solve. Please give direction.
Answer the question
In order to leave comments, you need to log in
It would be necessary to type on normal. I got on the righteous path of TS - forget about all sorts of any.
...
<RegulationEditWindow setIsEditing={setIsEditing} />
...
interface RegulationEditWindowProps {
setIsEditing(editing: boolean): void;
}
const RegulationEditWindowView: React.FC<RegulationEditWindowProps> = React.memo((props) => {
...
<ArrowLeftOutlined onClick={() => props.setIsEditing(false)} />
...
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question