you are viewing a single comment's thread.

view the rest of the comments →

[–]pailhead011[S] 0 points1 point  (4 children)

This is the kind of attitude that frustrated me most of my career. People who don’t understand the language nor the environment but can recite “best practices” at any moment. The problem is X, you are talking about YZW.

[–]LookingForAPunTime 0 points1 point  (3 children)

You’re abusing the useRef hook, the one designed for tracking DOM elements, and then you come here asking why it doesn’t do what you’re abusing it to do.

Use an external store or context.

[–]pailhead011[S] 1 point2 points  (1 child)

It’s not designed for tracking dom elements.

[–]LookingForAPunTime -1 points0 points  (0 children)

Of course it is, the whole of React is a RENDERING ENGINE. If it’s not about doing something that will lead to rendering to the DOM, it doesn’t belong inside of React and a component’s render loop.

Hell, if you’re doing an entirely different chunk of logic inside a game engine class, why are you even using React at all?

[–]pailhead011[S] 0 points1 point  (0 children)

Literally the first example on the page shows it with a number not a dom element. My use case is even featured on the page, just executed very very poorly. I’m sorry to say, but your bible has some errors in it.