加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

react LinkedStateMixin 已经过时

发布时间:2020-12-15 08:16:09 所属栏目:百科 来源:网络整理
导读:页面会报告已经警告 Warning : ` valueLink ` prop on ` input ` is deprecated; set ` value ` and ` onChange ` instead. Note: LinkedStateMixin is deprecated as of React v15. The recommendation is to explicitly set the value and change handler,

页面会报告已经警告

Warning: `valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.
Note: LinkedStateMixin is deprecated as of React v15. The recommendation is to explicitly set the value and change handler,instead of using LinkedStateMixin.

参考文档:https://facebook.github.io/react/docs/two-way-binding-helpers.html

DEMO 代码

npm install react-addons-linked-state-mixin –save

import React from 'react';
import Reflux from 'reflux'
var ReactDOM = require('react-dom');
import LinkedStateMixin from 'react-addons-linked-state-mixin'
var HelloWorld = React.createClass({
    mixins: [LinkedStateMixin],getInitialState: function() {
        return {message: 'Hello!'};
    },render: function () {
        return <div>
            {this.state.message}
            <input type="text"  valueLink={this.linkState('message')}/>

        </div>
    }
})
ReactDOM.render(
    <HelloWorld />,document.getElementById('J_contentContainer'))

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读