Skip to content

Instantly share code, notes, and snippets.

@goatslacker
Created May 22, 2015 21:35
Show Gist options
  • Save goatslacker/0d335362fb4347552ef7 to your computer and use it in GitHub Desktop.
Save goatslacker/0d335362fb4347552ef7 to your computer and use it in GitHub Desktop.
import React from 'react'
import Alt from 'alt'
import connectToStores from 'alt/utils/connectToStores'
const alt = new Alt()
const TimelineStore = alt.createStore({
displayName: 'TimelineStore',
state: {}
})
class Timeline extends React.Component {
componentWillMount() {
console.log(2)
}
componentDidMount() {
console.log(3)
}
render() {
console.log('Second')
return <div>Timeline!</div>
}
}
class TimelineContainer extends React.Component {
static getStores() {
return [TimelineStore];
}
static getPropsFromStores(props) {
return {
timeline: TimelineStore.getState()
};
}
componentWillMount() {
console.log(1)
}
componentDidMount() {
console.log(4)
}
render() {
console.log('First')
return (
<Timeline {...this.props} />
);
}
};
const component = React.createElement(connectToStores(TimelineContainer))
//console.log(React.renderToString(
//))
React.render(component, document.body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment