Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Doing React all wrong...
var ScheduleStore = Reflux.createStore({
init(){
this.listenToMany(ScheduleActions);
},
schedule(){
return this._schedule;
},
setSchedule(schedule){
this._schedule = schedule;
}
//... other store logic
}
var Scheduler = React.createClass({
mixins: [Reflux.connect(ScheduleStore, 'schedule')],
getInitialState(){
return {schedule: ScheduleStore.schedule()};
},
render(){
//...
}
});
=content_for :javascript do
javascript:
ScheduleStore.setSchedule(JSON.parse('#{ schedule.to_json.html_safe}'));
h1 Schedule
= react_component("Scheduler")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.