A helper util to use LinkedStateMixin for ES6
npm install react-link-stateNote: This might be deprecated soon as there are plans to deprecate ReactLink (#2302).
bash
npm install react-link-state --save
`Usage
`es6
import React from 'react';
import linkState from 'react-link-state';export default MyForm extends React.Component {
constructor(props) {
super(props);
this.state = {
username: '',
password: '',
toggle: false
};
}
render() {
console.log(this.state);
return (
);
}
}
`checkedLink for checkboxes.Deep link-state is also supported!
`es6
// Given that we have this state:
// {
// users: [{
// profile: {
// first_name: ''
// }
// }]
// }
`Testing
`
npm test
`You need node
v4.0.0` to runs the tests. See issue.> You will need to have window, window.document and window.document.createElement globally available before you import React. Otherwise React will think it can't access the DOM and methods like setState won't work.