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

语法糖 VS 性能

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

    腾讯云最新优惠活动来了:云产品限时1折,云服务器低至88元/年 ,点击这里立即抢购:9i0i.cn/qcloud,更有2860元代金券免费领取,付款直接抵现金用,点击这里立即领取:9i0i.cn/qcloudquan

    (福利推荐:你还在原价购买阿里云服务器?现在阿里云0.8折限时抢购活动来啦!4核8G企业云服务器仅2998元/3年,立即抢购>>>:9i0i.cn/aliyun

    转向 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   ·   实用小工具   ·   5580 人在线   最高记录 6547   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 01:12 · PVG 09:12 · LAX 18:12 · JFK 21:12
    Developed with CodeLauncher
    ? Do have faith in what you're doing.


    http://www.vxiaotou.com