48 Matching Annotations
  1. Nov 2023
  2. Aug 2023
  3. Jul 2022
  4. Nov 2020
  5. Oct 2020
  6. Sep 2020
    1. I’ve seen some version of this conversation happen more times than I can remember. And someone will always say ‘it’s because you’re too used to thinking in the old way, you just need to start thinking in hooks’.

      But after seeing a lot of really bad hooks code, I’m starting to think it’s not that simple — that there’s something deeper going on.

  7. Aug 2020
  8. Jul 2020
  9. May 2020
  10. Apr 2020
  11. Dec 2019
    1. Mutations, subscriptions, timers, logging, and other side effects are not allowed inside the main body of a function component (referred to as React’s render phase). Doing so will lead to confusing bugs and inconsistencies in the UI.

      key point!

    2. In React class components, the render method itself shouldn’t cause side effects. It would be too early — we typically want to perform our effects after React has updated the DOM.

      key point!

    3. Custom Hooks are more of a convention than a feature. If a function’s name starts with ”use” and it calls other Hooks, we say it is a custom Hook. The useSomething naming convention is how our linter plugin is able to find bugs in the code using Hooks.

      as can be seen above, indeed nothing explicetly tells that the function is a special kind of hook. its just a function...

    1. Data fetching, setting up a subscription, and manually changing the DOM in React components are all examples of side effects

      key point. this means that all those small messing of variables in code that gets rendered into the template of the component? this is all 'side effects', and of course we do this all the time...

  12. Nov 2019
  13. Oct 2019
  14. Sep 2019
  15. Aug 2019