1

I have a php page that works as the parent - container.php. Another react.php contains ReactJS objects that displays well if I access it directly.

However, when I try to AJAX load react.php from the container.php using JQuery.load function, the ReactJS objects are not rendered at all.

In container.php

$(".res").load("react.php", function(data) {
    $(".res").html(data);
})

Is there any workaround for this?

feng63600
  • 183
  • 1
  • 2
  • 13
  • This might help: http://stackoverflow.com/questions/37337289/react-js-set-innerhtml-vs-dangerouslysetinnerhtml – Rajesh Nov 15 '16 at 08:28

1 Answers1

0

The solution of the issue was simple. In the container page, you should also render the ReactJS objects in the React way. You may find below procedures helpful:

  1. pack your react objects in a babel js file
  2. include the js in the container file
  3. render the object and display in the container page
feng63600
  • 183
  • 1
  • 2
  • 13