0

In JQuery, you can use $(document).on("event-name", "selector-name", callback() ) to handle events on elements that already exist in the DOM as well as those that are dynamically inserted later into the DOM after page load (Eg. Elements created from server side)

My question though is how do we achieve this event handling on dynamically inserted elements in ReactJS given the fact that React works with virtual DOM.

Thank you very much for any help

Isaac Newton
  • 21
  • 1
  • 6

1 Answers1

0

You create a component and attach an event handler to their synthetic event in the jsx. Later when you use this component it will have the desired event handler

voiys
  • 269
  • 5
  • 14