/**1* Copyright 2013-2015, Facebook, Inc.2* All rights reserved.3*4* This source code is licensed under the BSD-style license found in the5* LICENSE file in the root directory of this source tree. An additional grant6* of patent rights can be found in the PATENTS file in the same directory.7*8* @providesModule LinkedStateMixin9* @typechecks static-only10*/1112'use strict';1314var ReactLink = require("./ReactLink");15var ReactStateSetters = require("./ReactStateSetters");1617/**18* A simple mixin around ReactLink.forState().19*/20var LinkedStateMixin = {21/**22* Create a ReactLink that's linked to part of this component's state. The23* ReactLink will have the current value of this.state[key] and will call24* setState() when a change is requested.25*26* @param {string} key state key to update. Note: you may want to use keyOf()27* if you're using Google Closure Compiler advanced mode.28* @return {ReactLink} ReactLink instance linking to the state.29*/30linkState: function(key) {31return new ReactLink(32this.state[key],33ReactStateSetters.createStateKeySetter(this, key)34);35}36};3738module.exports = LinkedStateMixin;394041