转向 vue 后,又学习下 react16,
一开始我以为 React 16 会完全移除createClass
方法,没想到只是换个名字,而且连在 react15 中的不推荐也移除了,
The deprecations introduced in 15.x have been removed from the core package. React.createClass is now available as create-react-class, React.PropTypes as prop-types, React.DOM as react-dom-factories, react-addons-test-utils as react-dom/test-utils, and shallow renderer as react-test-renderer/shallow. See 15.5.0 and 15.6.0 blog posts for instructions on migrating code and automated codemods.
本来还担心为了一点点的性能每次都去bind
好麻烦,现在直接用createReactClass
也是一样
那么现在 react 开发中,大家喜欢class
还是createReactClass
1
crysislinux 2018-01-01 20:42:34 +08:00 via Android
这个迁移跟性能没关系,是因为有 class 的标准了就往 class 靠。原来那种方式还是会 bind,只不过是框架帮你做了
|
2
Kilerd 2018-01-01 21:44:31 +08:00
autobind_decorator
|