79444584

Date: 2025-02-17 06:40:59
Score: 0.5
Natty:
Report link

The states will be cleaned up automatically for an unmounted component. The app code does not do anything for it. You may see the same discussed here.

The doc here says not to do the below code. The state setter inside a clean up to be removed. Though this documentation is outdated, the same point is there in the new documentation as well.

return () => {
   // Cleanup function to clear data
   setData([]);
};

Another discussion of the same kind can see here as well

Reasons:
  • Blacklisted phrase (1): this document
  • Has code block (-0.5):
Posted by: WeDoTheBest4You