Skip to content

Instantly share code, notes, and snippets.

@jcreamer898
Created February 4, 2015 19:25
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 jcreamer898/fbf128ebf3cff531719d to your computer and use it in GitHub Desktop.
Save jcreamer898/fbf128ebf3cff531719d to your computer and use it in GitHub Desktop.
// app.js
React.render(App({
	initialData: window.initialData
}));
// app.jsx
var App = React.createClass({
	getInitialState() {
		var data = this.props.initialData;

		AppActionCreators.setInitialData(data)
		
		return {
			data: data
		};
	},
	render() {
		return (
			<Foo stuff={this.state.data.foo} />
		);
	}
});
// Foo.jsx
var Foo = React.createClass({
	getInitialState() {
		return {
			foo: this.props.foo
		};
	},
	render() {
		<div>{this.state.foo}</div>
	}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment