Skip to content

Instantly share code, notes, and snippets.

@prenaudin
Created June 8, 2016 16:35
Show Gist options
  • Save prenaudin/59d085e3487135dd673c600ae3226e7a to your computer and use it in GitHub Desktop.
Save prenaudin/59d085e3487135dd673c600ae3226e7a to your computer and use it in GitHub Desktop.
Immutable.Record + React + Redux = ❤ - 5
// @flow
import Immutable from 'immutable';
const defaultRecord = {
id: string;
done: boolean;
label: string;
createdAt: string;
updatedAt: string;
} = {
id: null,
done: false,
label: '',
createdAt: null,
updatedAt: null,
};
const TaskRecord = Immutable.Record(defaultRecord)
class Task extends TaskRecord {
isDone() {
return this.get('done');
}
getLabel() {
return this.get('label') || 'New Task';
}
}
export default Task;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment