Tag:hooks

  • Realization, origin and solution of react hooks

    Time:2020-4-18

    What is the difference between react functional components and react class components? The general answers are: Class components have more features than functional components, such as state. What if there are hooks? Function components perform better than class components, but in modern browsers, the original performance of closures and classes is significantly different only in […]

  • Combined with react’s effect hook to analyze the elimination of side effects of components

    Time:2020-1-26

    A component to subscribe to friends online We subscribed to our friends’ online status through ID when we were in didmountAnd to prevent memory leaks, we need to clear the subscription in willunmount But what happens when the friend prop changes when the component is already on the screen? Our component will continue to show […]

  • Do you really use react hooks correctly?

    Time:2020-1-24

    From the official release of react hooks to now, I have been using it in projects. However, in the process of using hooks, I have also entered into some errors, resulting in hidden bugs in the written code and difficult to maintain. In this article, I will analyze these problems and summarize some good practices […]

  • How to write react class component with hooks?

    Time:2019-12-19

    The API of hooks can refer to the react official website. This article mainly explains how to use hooks to realize the write method of react class component with demo, so that you can understand the mechanism of hooks more deeply and get started faster.Note: the writing method of rax is consistent with react. Demo […]

  • Redux crash course based on hooks

    Time:2019-11-19

    Original text: Redux crash course with hooksBy Chris AchardTranslator: BoxuanIn order to ensure the readability of the article, this paper adopts free translation Are you confused about Redux?If you use the new Redux hooks, it will be easier!Here is a quick course about Redux, which will be used in conjunction with the react function component: […]

  • Deep understanding of hooks in vue.js

    Time:2019-11-19

    background Recently, we have studied the latest development of vue3.0, and found that it has changed a lot. On the whole, Vue has begun to move closer to hooks, and the author of Vue himself also said that the features of vue3.0 draw a lot of inspiration from hooks. So before the official release of […]

  • Using Redux + hooks to complete a small instance

    Time:2019-11-8

    React hooks is a new feature of react in version 16.8. Before 16.8, react function components could not use state, life cycle and other functions, but with hooks, they could use functional writing as powerful components as classes. What’s wrong with the class component? In the past, it was normal to use a class to […]