Open daslicht opened 9 years ago
You can add react-dom into the code as follows: Caveat: this will not fix ReactDOMServer.renderToString in getMarkup()
Add react-dom.js to the parameters in example.php:
$rjs = new ReactJS(
file_get_contents('../../react/build/react.js'), // location of React's code
file_get_contents('../../react/build/react-dom.js'), // location of React's code
file_get_contents('../../react/build/table.js') // app code
);
Amend the constructor in ReactJS.php as follows:
function __construct($libsrc, $libsrcDom, $appsrc)
{
$react = array();
// stubs, react
$react[] = "var console = {warn: function(){}, error: print}";
$react[] = "var global = global || this, self = self || this, window = window || this";
$react[] = $libsrc;
$react[] = $libsrcDom;
$react[] = "var React = global.React";
$react[] = "var ReactDOM = global.ReactDOM";
// app's components
$react[] = $appsrc;
$react[] = ';';
Replace React with ReactDOM in getJS()
"ReactDOM.render(React.createElement(%s, %s), %s);",
When I run the example I get the following warnings:
How to fix ?