3 ms·
This isn't a React issue; this is a failure to use an abstraction where appropriate. React offers the classSet plugin for exactly this use case. http://faceboo
by matchu 12y ago
This isn't a React issue; this is a failure to use an abstraction where appropriate. React offers the classSet plugin for exactly this use case.
http://facebook.github.io/react/docs/class-name-manipulation.html http://facebook.github.io/react/docs/class-name-manipulation...
I think the React authors agree that React classes shouldn't contain excessive logic; if your class does, consider extracting it to somewhere more appropriate.
- krawaller 12y agoOh, indeed, I've completely missed the classSet plugin! That would indeed make the code more elegant. And fair point about the logic perhaps being too complicated here. Thanx for the pointers!