- Mastering Immutable.js
- Adam Boduch
- 53字
- 2021-07-08 10:30:07
Records
A record is closer to a JavaScript object than to an Immutable.js map. The idea here is that records have a predetermined set of allowable string keys, which can specify default values when not provided:
const MyRecord = Record({});
const myRecord = new MyRecord();
console.log('Record', myRecord instanceof Record);
// -> Record true