DEV Community

Arash Jangali
Arash Jangali

Posted on

Exploring useRef, useMemo, and the Challenges of Working with Multiple Components

Day 95 of #100DaysOfCode: Today, I’ve been immersed in the world of buttons, particularly the undo button. Within the MainButtons component, which is a child component of ClientDashboard, I’ve set up the functionality to trigger the handleUndo function when the undo button is clicked. This, in turn, calls the undoFunction() responsible for executing the undo action.

To manage the undo function effectively, I’ve utilized the useState hook. It allows me to seamlessly handle the state of the undoFunction within the Customer component, another child component of ClientDashboard. The connection between these components is established using the useEffect hook, which ensures that the undoFunction is properly updated whenever any changes occur.

The ClientDashboard component keeps throwing an error, claiming that undoFunction is not a function. I’m currently debugging this issue.

Stay tuned for further updates on my progress as I continue to unravel the mysteries of buttons and conquer the challenges that come my way 😆

Top comments (0)