ReactJS与Typescript的双向绑定

时间:2015-11-09 12:09:40

标签: javascript reactjs typescript

我正在使用Typescript编写ReactJS应用程序而且我不知道如何指定双向绑定:

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

React.Component类上没有valueLink可用。该组件可以实现LinkedStateMixin接口,但我不知道linkState方法的内容应该是什么,以及如何将所有内容连接在一起。

有人可以提供一些例子吗?

1 个答案:

答案 0 :(得分:0)

  

值链接可用于React.Component类

这是因为React classes 不支持 mixins

要使用LinkedStateMixin mixin,您需要使用createClass,这对于TypeScript / ES6 class land中的代码安全来说是完整的未注册

更多

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

enter image description here