dxcqcv
V2EX  ›  React

语法糖 VS 性能

  •  
  •   dxcqcv · Jan 1, 2018 · 3307 views
    This topic created in 3080 days ago, the information mentioned may be changed or developed.

    转向 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 replies    2018-01-01 21:44:31 +08:00
    crysislinux
        1
    crysislinux  
       Jan 1, 2018 via Android
    这个迁移跟性能没关系,是因为有 class 的标准了就往 class 靠。原来那种方式还是会 bind,只不过是框架帮你做了
    Kilerd
        2
    Kilerd  
       Jan 1, 2018
    autobind_decorator
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1128 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 23:04 · PVG 07:04 · LAX 16:04 · JFK 19:04
    ♥ Do have faith in what you're doing.