DEV Community

[Comment from a deleted post]
Collapse
 
guico33 profile image
guico33 • Edited

While it might make sense for the sake of the example, I believe there are more idiomatic ways to achieve the same behaviour in react without using a ref.
Typically you'd pass event handlers to the react element directly and update a variable in state to determine which classes to use.

Collapse
 
rleija_ profile image
Ruben

Agree! I believe Netflix has a rule to never use references.

If you can use state and props, use those