javascript - How should i handle reactJS dom manipulate (like scroll manipulation for example) -


lets wanna pretty simple - upon scroll change title fixed, ok directly manipulate dom? if not how else should attack this?

for example:

componentdidmount: function() {     $('.content').bind('scroll',function(){         if ( $(this).scrolltop() > 85) {             $('#x').addclass('fixedtitle');          } else {             $('#x').removeclass('fixedtitle');          }     }); }, componentwillunmount: function() {     $('.content').unbind("scroll"); } 

and if wanna more complex, understand element @ view , give different class example?

jquery tools , reactjs don't play nicely together. if manipulate dom, react's virtual representation of dom becomes out of sync actual dom. if you're doing small changes class fixed, won't issue.

if doing bigger understanding element @ view (not entirely sure mean that), element should react component.

class names can changed in react, done based on kind of state. check out tool doing in react code: https://github.com/jedwatson/classnames.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -