Giter Club home page Giter Club logo

Comments (1)

anuoua avatar anuoua commented on July 26, 2024

返回一个 render 函数,相当于 class component 里的 render 方法,本质上,class 组件也没有每次渲染就都全都跑一遍的问题,useProps 都在 this.props 上,甚至还能拿到 prevProps,这通优化下来,不知道会不会有一种「诶?class 组件好像就挺好」的感觉?

把那些 hooks(FC组件的优势) 都加回来,性能是否还有很大优化的效果呢?

很有意思的说法,class 组件的最大问题就是复用、抽象、类型约束都不够易用,React 转移到 FC 后,前面的问题可以说已经解决。

而 Unis 想要解决的问题并不是 class 的问题,而是 React FC 的问题,从 React class -> React FC -> Unis 都是在前者优势上发展而来的,所以不可能退回去设计 class component。

至于性能,其实社区也有不少优秀的实践案例,只不过我看了几个都会限制 jsx 的自由发挥,看取舍,传统方案的虚拟DOM前端框架基本就这样了。

from unis.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.