Last active
January 15, 2017 18:14
-
-
Save cdelaorden/b9796182a996ffcdde1ed7a32de322e3 to your computer and use it in GitHub Desktop.
GoldenLayout with React / Redux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const layout = { | |
content: [{ | |
type: 'row', | |
content:[{ | |
//this indicates GL that it should ReactDOM.render this component | |
type:'react-component', | |
//component registerd name (more later) | |
component: 'test-component', | |
//additional props you want for your component | |
props: { label: 'A' } | |
},{ | |
type: 'column', | |
content:[{ | |
type:'react-component', | |
component: 'test-component', | |
props: { label: 'B' } | |
},{ | |
type:'react-component', | |
component: 'test-component', | |
props: { label: 'C' } | |
}] | |
}] | |
}] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TestComponent = React.createClass({ | |
render: function() { | |
return (<h1>{this.props.label}</h1>) | |
} | |
}); | |
myLayout.registerComponent( 'testComponent', TestComponent ); | |
//Once all components are registered, call | |
myLayout.init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment