skip to Main Content

Reactjs – Syncing States between parent and child

const [counter, setCounter] = useState(0); useEffect(() => { const intervalId = setInterval(() => { setCounter((prevCounter) => prevCounter + 1); }, 1000); return () => clearInterval(intervalId); }, []); const handleOpenModal = () => { showModal({ title: "Confirmation", key: `modal-${counter}-${Date.now()}`, content: ()…

VIEW QUESTION
Back To Top
Search