DEV Community

Discussion on: Why custom react hooks could destroy your app performance

Collapse
 
elvezpablo profile image
Paul

Great article and explanation, you make it so clear and concise very well done. Just wanted to make sure I understood that the ref isn't needed in the final code snippet.

<ModalBase onClosed={close} isOpen={isOpen} ref={ref} />
Enter fullscreen mode Exit fullscreen mode
Collapse
 
adevnadia profile image
Nadia Makarevich

You mean in ModalBaseWithAnalytics? (this is the last one)

Or for one of the ModalBase before? On <ModalBase it's always needed, since it passes ref down to the div. On ModalBaseWithAnalytics it's not needed, since the ref is created inside of this component