Skip to content

Instantly share code, notes, and snippets.

@cdelaorden
Last active January 15, 2017 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdelaorden/b9796182a996ffcdde1ed7a32de322e3 to your computer and use it in GitHub Desktop.
Save cdelaorden/b9796182a996ffcdde1ed7a32de322e3 to your computer and use it in GitHub Desktop.
GoldenLayout with React / Redux
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' }
}]
}]
}]
}
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