Answer the question
In order to leave comments, you need to log in
How to make modal window component appear on button click in React?
There are 3 components. Parent component Container, it stores ContainerItems. When you click on the button inside the ContainerItem'a, a full-screen modal window should appear, where the ContainerItem's data will be transferred (Something like adding pizza on the DoDo website). How to implement it?
Answer the question
In order to leave comments, you need to log in
const Container = () => {
const [shownItemId, setsShownItemId] = useState('');
.....
<ContainerItem itemId={id} onShowDetails={() => setsShownItemId(id)} ... />
.....
{shownItemId && <Modal itemId={shownItemId} ... />
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question