最新公告
  • 欢迎您光临起源地模板网,本站秉承服务宗旨 履行“站长”责任,销售只是起点 服务永无止境!立即加入钻石VIP
  • Performance Thinking on Front End (Reactjs)

    正文概述 掘金(字节前端)   2021-08-06   446

    Performance is a big word, which you can see everywhere which many layers as Front End, Back End, Infrastructures, Scalable, ... So for this article, I talk the performance thinking on Front End, especially ReactJS which one of the popular UI libraries nowadays.

    Disclaimer: As mentioned above, Performance is a huge thing, the article bases on my knowledge and experience so it might not cover everything, feel free to correct me by adding the comment if I was wrong

    Let's Performance Thinking as entire Application not only the benchmark

    Nowadays you will hear new UI libraries or frameworks with better performance and impressive benchmark which make me have the feeling that libraries have racing about the performance but in the real world, the application is more complicated than only set the count...

    References:

    • krausest.github.io/js-framewor…
    • javascript.plainenglish.io/javascript-…

    To clarify, I wouldn't say benchmark is wrong, Benchmark is one of the factors to help us see how library performs on some scenarios but I would suggest that don't take it as the main reason to choose the library/frameworks because nowadays those popular libraries/frameworks have really good performance, most of the time we won't see different which libraries/frameworks should not us care about it.

    One of the good things about ReactJS is they have Facebook's environment with billions of users for verification, they will see differences in their matrix performance good or bad after any releases which other libraries/frameworks might figure out the problem after one or two years hence it might be too late and might need to re-build entire libraries/frameworks, AngularJS version 1.xx is a good example.

    Performance Thinking and Data Flow are close Friend

    Most of the time, I see the reason performance issues or how to improve performance is data flow, the problem of how we manage our state management. When we have good data flow, it is automatic works pretty well because ReactJS is declarative UIs and they are really good at doing their jobs.

    Example:

    Designing Complicated Form which has a lot of components inside and we also need to collect all information user's selection to submit. At the same time we also re-fill it back when the user wants to edit hence declare defaultValue and value separately state to avoid re-render again. I can have another article in a more detailed Form and different ways how to implement it.ReactJS also has API useMemo, useCallBack to optimize performance so special scenarios but we optimize by moving state around. Here is a good article about it. overreacted.io/before-you-…

    Performance Thinking and Caching, Graphql also are close Friend

    Caching is hard, I would suggest that you don't need to implement it by yourself unless you have a strong reason. Otherwise, there are some good libraries supporting caching out of the box which you don't need to worry like

    • React Query: react-query.tanstack.com
    • ApolloGraphQL: www.apollographql.com/docs/react

    GraphQL is an interesting topic which we can discuss in another article.

    Hope everyone enjoys, I will plan the following topic with more detail and practical example if you guy wants.


    起源地下载网 » Performance Thinking on Front End (Reactjs)

    常见问题FAQ

    免费下载或者VIP会员专享资源能否直接商用?
    本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
    提示下载完但解压或打开不了?
    最常见的情况是下载不完整: 可对比下载完压缩包的与网盘上的容量,若小于网盘提示的容量则是这个原因。这是浏览器下载的bug,建议用百度网盘软件或迅雷下载。若排除这种情况,可在对应资源底部留言,或 联络我们.。
    找不到素材资源介绍文章里的示例图片?
    对于PPT,KEY,Mockups,APP,网页模版等类型的素材,文章内用于介绍的图片通常并不包含在对应可供下载素材包内。这些相关商业图片需另外购买,且本站不负责(也没有办法)找到出处。 同样地一些字体文件也是这种情况,但部分素材会在素材包内有一份字体下载链接清单。
    模板不会安装或需要功能定制以及二次开发?
    请QQ联系我们

    发表评论

    还没有评论,快来抢沙发吧!

    如需帝国cms功能定制以及二次开发请联系我们

    联系作者

    请选择支付方式

    ×
    迅虎支付宝
    迅虎微信
    支付宝当面付
    余额支付
    ×
    微信扫码支付 0 元