简体   繁体   English

ReactJS与Typescript的双向绑定

[英]ReactJS two-way binding with Typescript

I'm writting ReactJS application with Typescript and I don't know how to specify two-way bindings: 我正在使用Typescript编写ReactJS应用程序,我不知道如何指定双向绑定:

https://facebook.github.io/react/docs/two-way-binding-helpers.html https://facebook.github.io/react/docs/two-way-binding-helpers.html

There is no valueLink available on React.Component class. React.Component类上没有valueLink可用。 The component could implement LinkedStateMixin interface but I don't know what should be the content of linkState method and how to connect everything together. 该组件可以实现LinkedStateMixin接口,但我不知道linkState方法的内容应该是什么,以及如何将所有内容连接在一起。

Can anyone provide me some example? 任何人都可以提供一些例子吗?

valueLink available on React.Component class 值链接可用于React.Component类

This is because React classes do not support mixins . 这是因为React 不支持mixins

To use the LinkedStateMixin mixin you need to use createClass and that is complete unrecommeded for code safety in TypeScript / ES6 classes land. 要使用LinkedStateMixin你需要使用的mixin createClass ,这是完全unrecommeded在打字稿/ ES6类土地代码的安全性。

More 更多

https://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html https://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM