Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Commit 982464b

Browse files
committed
Merge pull request #3 from talyssonoc/update_react_api
Update react api
2 parents 27212d2 + 9ebe1ee commit 982464b

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

ReactJS.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function getMarkup() {
106106
try {
107107
$js = $this->react;
108108
$js.= sprintf(
109-
"React.renderComponentToString(%s(%s), print)",
109+
"print(React.renderToString(React.createElement(%s, %s)))",
110110
$this->component,
111111
$this->data);
112112

@@ -120,7 +120,7 @@ function getMarkup() {
120120
} else {
121121
// default error handler blows up bad
122122
echo "<pre>";
123-
var_dump($e);
123+
echo $e->getMessage();
124124
echo "</pre>";
125125
die();
126126
}
@@ -157,7 +157,7 @@ function getJS($where, $return_var = null) {
157157
return
158158
($return_var ? "var $return_var = " : "") .
159159
sprintf(
160-
"React.renderComponent(%s(%s), %s);",
160+
"React.render(React.createElement(%s, %s), %s);",
161161
$this->component,
162162
$this->data,
163163
$where

composer.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "reactjs/react-php-v8js",
3+
"description": "PHP library that renders React components on the server",
4+
"require": {
5+
"ext-v8js": ">=0.1.3"
6+
},
7+
"license": "BSD-3-Clause",
8+
"autoload": {
9+
"classmap": ["ReactJS.php"]
10+
}
11+
}

0 commit comments

Comments
 (0)