2
orton
5y

In react.js?... with react visual-DOM concept, does it fully support and work well with third party libraries ??

Comments
  • 3
    Yes. No. Maybe.

    You mean virtual dom?
    Does it play well with 3rd parties? React or the virtual dom?

    Whatever you're asking, I guess it works well... otherwise it'd be pretty useless, right?
  • 1
    Try it and report back pls
  • 2
    You can use traditional JS libraries (eg. jQuery plugins) after the component has monted. You can get node instances using refs and pass them to the library you want to use.

    Just remember to destroy the library's feature instances (stop timers, undo global listeners, etc.) before unmounting and reinitialize them when recreating nodes the library is interacting with.

    This usually applies to all DOM frameworks.
  • 0
    @Cultist i mean virtual dom, sorry for the error typing
  • 0
    I might be wrong here so correct me if I'm wrong but:

    The virtual dom is a React optimisation for doing a diff between the real dom and the previous dom on React's update cycle. React doesn't refresh anything that it doesn't think has changed for performance.

    Third party libraries that change the real dom should still work with React.

    There probably is a small performance hit but it depends on how often the third party library updates the dom.
  • 0
    @cmarshall10450 You are most probably right about React's VDOM, but what do you mean by the performance hit? Would the performace be worse then using the library outside of React app / component? React supposedly only updates the nodes it knows belong to it. SSR hydration might be an exception to the rule though.
Add Comment