Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
States in React are passed from top to bottom. (from parent to child). Typically, a parent component receives an action from a child component using functions.
const Parent= props =>{
const [active, setActive] = useState(0);
const onSeleсt = index =>{
setActive(index);
};
return <Items active={active} onSelect={onSelect} {...props}/>;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question