Skip to content

Instantly share code, notes, and snippets.

@karmajunkie
Created June 21, 2015 01:33
Show Gist options
  • Save karmajunkie/8dd5367837ee8d2bd5bd to your computer and use it in GitHub Desktop.
Save karmajunkie/8dd5367837ee8d2bd5bd to your computer and use it in GitHub Desktop.
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