Fireship · @fireship

They made React great again?

Uploaded February 26, 2024 · Length 4:11

They made React great again?

Summary

react team introduces compiler, improving developer experience, simplifying code, and removing unnecessary features like use memo and forward ref.

  • react compiler
  • react improvements
  • javascript framework
  • react hooks
  • react performance

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    a few days ago a shocking new blog post

  2. 0:02

    from the reactjs team dropped as a react

  3. 0:04

    hater I hate to say it but they fixed

  4. 0:06

    react I tried to let the hate flow

  5. 0:08

    through me but the react team made some

  6. 0:09

    brilliant moves that will dramatically

  7. 0:11

    improve the developer experience just

  8. 0:13

    when you thought react had become the

  9. 0:14

    new jQuery and the JavaScript framework

  10. 0:16

    wars were coming to an end the react

  11. 0:18

    team has Unleashed their secret weapon a

  12. 0:20

    compiler and in today's video we'll find

  13. 0:22

    out what that word means it is February

  14. 0:24

    26 2024 and you're watching the code

  15. 0:26

    report speaking of jQuery one thing that

  16. 0:28

    you may have missed is that after nearly

  17. 0:29

    a decade of anticipation jQuery just

  18. 0:32

    announced version 4.0 it got rid of a

  19. 0:34

    bunch of stuff made obsolete by the

  20. 0:35

    JavaScript language itself dropped ie1

  21. 0:38

    support and migrated to es modules most

  22. 0:40

    frontend developers nowadays are too

  23. 0:42

    smug and arrogant to use jQuery but this

  24. 0:44

    is great news for the millions of

  25. 0:45

    websites out there that still use it the

  26. 0:47

    big news though is that reactjs is

  27. 0:49

    getting a compiler meta is already using

  28. 0:51

    this compiler in production to power

  29. 0:52

    Instagram and will likely bring solid

  30. 0:54

    performance improvements but most

  31. 0:56

    importantly it will simplify the code we

  32. 0:58

    write as developers Developers L react

  33. 1:00

    code is pretty ridiculous compared to

  34. 1:02

    Frameworks like view felt and solid like

  35. 1:04

    imagine we have some state that needs to

  36. 1:06

    be computed into another value we can do

  37. 1:08

    it like this in react but that value

  38. 1:10

    will be unnecessarily recomputed every

  39. 1:12

    time the component reeners it's

  40. 1:14

    inefficient to address this react

  41. 1:15

    provides a hook called use memo memo

  42. 1:17

    means memoization which itself means

  43. 1:19

    remember it wraps the computation in

  44. 1:21

    another function which will only run

  45. 1:23

    when the state that it's dependent on

  46. 1:24

    changes which has to be explicitly put

  47. 1:26

    in this array if we look at all the

  48. 1:27

    other Frameworks though they don't do

  49. 1:29

    stuff like this like in view we have

  50. 1:31

    this computed function but there's no

  51. 1:32

    need to include that dependency array

  52. 1:34

    and in spell 3 it's even more simple

  53. 1:36

    with the dollar sign syntax although

  54. 1:37

    it's being replaced with a rune in spel

  55. 1:39

    5 the reason these Frameworks can let

  56. 1:40

    you write more simplified code is

  57. 1:42

    because they have a compiler unlike

  58. 1:43

    react which is purely runtime based they

  59. 1:46

    look at your code in advance to figure

  60. 1:47

    out where the reactivity is and bundle

  61. 1:49

    that into the final product that goes to

  62. 1:51

    the browser but now that react is

  63. 1:52

    getting its own compiler it means hooks

  64. 1:54

    like use memo and use callback are a

  65. 1:56

    thing of the past and that's huge

  66. 1:58

    because not only is the code ugly as as