- This provides React PropTypes for Immutable.js data.
- This is the equivalent of
React.PropTypes.instanceOf(Immutable.Type)
so you can do all the normal stuff
.isRequired
, nest in .oneOfType
, etc.
- React and Immutable are peer dependencies, so this will not install those for you.
- This module works with any version of React and Immutable you have installed! 🍺
npm install immutable-props --save
- Iterable
- Seq
- Collection
- Map
- OrderedMap
- List
- Stack
- Set
- OrderedSet
- Record
- Range
- Repeat
- Cursor
var IPropTypes = require('immutable-props');
var UserPage = React.createClass({
propTypes: {
user: IPropTypes.Map,
friends: IPropTypes.List
},
render: function() {
// ...
}
});
import IPropTypes from 'immutable-props'
class UserPage extends React.Component {
static propTypes = {
user: IPropTypes.Map,
friends: IPropTypes.List
};
render () {
// ...
}
}
import { Map, List } from 'immutable-props'
class UserPage extends React.Component {
static propTypes = {
user: Map,
friends: List
};
render () {
// ...
}
}