@fazzaamiarso
Posted
Hi @MrDannie! It's awesome that you complete this complex project while learning a new framework!
I just have a couple suggestions for you:
- I noticed that you use
react-hooks-global-state
for Global State. I suggest to take a look atJotai
which do the same thing and same maintainer, but still active and maintained. - For some side-effects like inserting item into LocalStorage, it's better to first do it inside Event Handler, rather than
useEffect
that can be tricky to track. You can refer to this docs. For example inApp.jsx
// instead of this
useEffect(() => {
localStorage.setItem("BoardData", JSON.stringify(boardData));
}, [boardData]);
// do this
const updateAppData = (data) => {
setAppBoardData(data);
// here, what trigger the side effect is immediately obvious
localStorage.setItem("BoardData", JSON.stringify(data));
};
I hope it helps! Cheers!
Marked as helpful
@MrDannie
Posted
Thank you so much @fazzaamiarso, I appreciate the feedback, twas really helpful. I will revisit the code and see how I can incorporate that. Thanks a bunch!