Registry / testing / react-addons-linked-state-mixin

react-addons-linked-state-mixin

JSON →
library15.6.2jsnpmunverified

A legacy React addon providing LinkedStateMixin for two-way binding in React forms, allowing components to easily sync state with input values. Current stable version is 15.6.2, but it is no longer maintained and deprecated in favor of explicit value/onChange patterns. For React 16+, separate react-linked-input package is required. It uses mixins, which are incompatible with ES6 classes and modern React. Alternatives include controlled components with useState.

npm install react-addons-linked-state-mixin
INSTALL
IMPORT
SIG · REACT-ADDONS-LINKE
R
react-addons-linked-state-mixin
testingjavascriptv15.6.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LinkedStateMixin
import LinkedStateMixin from 'react-addons-linked-state-mixin'
const LinkedStateMixin = require('react-addons-linked-state-mixin').LinkedStateMixin
Default export; named import will fail. Also available via global React.addons.LinkedStateMixin
LinkedInput
import LinkedInput from 'react-linked-input'
import { LinkedInput } from 'react-linked-input'
Default export from separate package, required for React 16+
mixins
var createReactClass = require('create-react-class'); var MyComponent = createReactClass({ mixins: [LinkedStateMixin], ... })
class MyComponent extends React.Component { mixins: [LinkedStateMixin] }
Mixins only work with createReactClass, not ES6 classes

Demonstrates using LinkedStateMixin with createReactClass to create a two-way bound input via valueLink.

var createReactClass = require('create-react-class'); var LinkedStateMixin = require('react-addons-linked-state-mixin'); var { render } = require('react-dom'); var App = createReactClass({ mixins: [LinkedStateMixin], getInitialState: function() { return { message: 'Hello!' }; }, render: function() { return <input type="text" valueLink={this.linkState('message')} />; } }); render(React.createElement(App), document.getElementById('root'));
Debug
Known issues
deprecatedPackage is no longer maintained and deprecated; do not use in new code.
fix
Use controlled components with useState and onChange handlers instead.
affects: >=15.0.0
breakingReact 15.6.2 is the last version; React 16+ requires separate react-linked-input package for LinkedInput.
fix
Install react-linked-input and use LinkedInput component with valueLink.
affects: >=16.0.0
gotchaLinkedStateMixin only works with React.createClass (create-react-class) and not with ES6 class components.
fix
Use create-react-class package or migrate to functional components with hooks.
affects: >=15.0.0
gotchavalueLink prop is only available on input/textarea/select elements and requires LinkedStateMixin.
fix
Ensure component has mixins: [LinkedStateMixin] and use this.linkState('stateKey') to create the valueLink object.
affects: >=15.0.0
Errors
Common errors & fixes
Cannot read property 'linkState' of undefined
Component does not have LinkedStateMixin in mixins array.
fix
Add mixins: [LinkedStateMixin] to the component definition.
LinkedStateMixin is not a function
Incorrect import; trying to call LinkedStateMixin as a function instead of using as mixin.
fix
Correct usage: mixins: [LinkedStateMixin] (an array), not mixins: LinkedStateMixin.
Support for the ES5Class pattern is deprecated. Use React.createClass instead.
Using React.createClass without the create-react-class package in React 16+.
fix
Install create-react-class and use var createReactClass = require('create-react-class');
Upgrade
Version history
15.6.2latest on npm
Audit
Dependencies
reactrequiredPeer dependency; LinkedStateMixin only works with React's legacy createClass and mixins
react-linked-inputoptionalRequired for React 16+ to use the linked input pattern; provides LinkedInput component
Agent activity
6 hits · last 30 days
node
6
Resources
react-addons-linked-state-mixin — npm install react-addons-linked-state-mixin · libregistry