V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
dxcqcv
V2EX  ›  React

语法糖 VS 性能

  •  
  •   dxcqcv · 2018-01-01 19:18:14 +08:00 · 2363 次点击
    这是一个创建于 2277 天前的主题,其中的信息可能已经有所发展或是发生改变。

    转向 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

    2 条回复    2018-01-01 21:44:31 +08:00
    crysislinux
        1
    crysislinux  
       2018-01-01 20:42:34 +08:00 via Android
    这个迁移跟性能没关系,是因为有 class 的标准了就往 class 靠。原来那种方式还是会 bind,只不过是框架帮你做了
    Kilerd
        2
    Kilerd  
       2018-01-01 21:44:31 +08:00
    autobind_decorator
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3940 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 10:24 · PVG 18:24 · LAX 03:24 · JFK 06:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.