File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
src/rsg-components/Preview Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -85,10 +85,10 @@ export default class Preview extends Component {
85
85
86
86
const exampleComponent = this . props . evalInContext ( exampleComponentCode ) ;
87
87
88
- // Wrap everything in a react component, such that we can leverage the state management of this component
88
+ // Wrap everything in a react component to leverage the state management of this component
89
89
class PreviewComponent extends Component { // eslint-disable-line react/no-multi-comp
90
- constructor ( props ) {
91
- super ( props ) ;
90
+ constructor ( ) {
91
+ super ( ) ;
92
92
93
93
const state = { } ;
94
94
const initialStateCB = ( initialState ) => {
@@ -108,11 +108,7 @@ export default class Preview extends Component {
108
108
return < pre className = { s . playgroundError } > { this . state . error } </ pre > ;
109
109
}
110
110
111
- const setState = ( nextState , callback ) => this . setState ( nextState , callback ) ;
112
- const state = this . state ;
113
-
114
- // Pass through props from the wrapper component
115
- return React . cloneElement ( exampleComponent ( state , setState , null ) , this . props ) ;
111
+ return exampleComponent ( this . state , this . setState . bind ( this ) , null ) ;
116
112
}
117
113
}
118
114
You can’t perform that action at this time.
0 commit comments