You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,8 +66,8 @@ class CustomComponent extends Component{
66
66
return new div([
67
67
new p('Hello World', ['style'=> 'color:red;background:blue']),
68
68
new div('Many div'),
69
-
new button("set my state ($test)", ['onclick'=> "phpReact.setState('$this->id', {test: ".($test+1)."})"]) //in setState must pass the id
70
-
], ['style'=> 'border:1px solid #eee;border-radius:4px;max-width:500px;padding:5px;margin:10px', 'id'=> $this->id]); //must add id to generated component id
69
+
new button("set my state ($test)", ['onclick'=> "this.setState({test: ".($test+1)."})"])
@@ -96,8 +96,8 @@ class CustomComponent extends Component{
96
96
return new div([
97
97
new p('Hello World', ['style'=> 'color:red;background:blue']),
98
98
new div('Many div'),
99
-
new button("set my state ($test)", ['onclick'=> "phpReact.setState('$this->id', {test: ".($test+1)."})"]) //in setState must pass the id
100
-
], ['style'=> 'border:1px solid #eee;border-radius:4px;max-width:500px;padding:5px;margin:10px', 'id'=> $this->id]); //must add id to generated component id
99
+
new button("set my state ($test)", ['onclick'=> "this.setState({test: ".($test+1)."})"])
100
+
], ['style'=> 'border:1px solid #eee;border-radius:4px;max-width:500px;padding:5px;margin:10px',]); //must add id to generated component id
0 commit comments