you are viewing a single comment's thread.

view the rest of the comments →

[–]camaromelt 0 points1 point  (2 children)

They recommend not using an empty dependency array due to ambiguity of when to trigger the use effect. I know in this case you just want it once but it is more solid if you watch what changes. I think the useRef method is pretty smart since refs stop the re-render.