Fireship · @fireship
They made React great again?
Uploaded February 26, 2024 · Length 4:11
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.
- 0:00
a few days ago a shocking new blog post
- 0:02
from the reactjs team dropped as a react
- 0:04
hater I hate to say it but they fixed
- 0:06
react I tried to let the hate flow
- 0:08
through me but the react team made some
- 0:09
brilliant moves that will dramatically
- 0:11
improve the developer experience just
- 0:13
when you thought react had become the
- 0:14
new jQuery and the JavaScript framework
- 0:16
wars were coming to an end the react
- 0:18
team has Unleashed their secret weapon a
- 0:20
compiler and in today's video we'll find
- 0:22
out what that word means it is February
- 0:24
26 2024 and you're watching the code
- 0:26
report speaking of jQuery one thing that
- 0:28
you may have missed is that after nearly
- 0:29
a decade of anticipation jQuery just
- 0:32
announced version 4.0 it got rid of a
- 0:34
bunch of stuff made obsolete by the
- 0:35
JavaScript language itself dropped ie1
- 0:38
support and migrated to es modules most
- 0:40
frontend developers nowadays are too
- 0:42
smug and arrogant to use jQuery but this
- 0:44
is great news for the millions of
- 0:45
websites out there that still use it the
- 0:47
big news though is that reactjs is
- 0:49
getting a compiler meta is already using
- 0:51
this compiler in production to power
- 0:52
Instagram and will likely bring solid
- 0:54
performance improvements but most
- 0:56
importantly it will simplify the code we
- 0:58
write as developers Developers L react
- 1:00
code is pretty ridiculous compared to
- 1:02
Frameworks like view felt and solid like
- 1:04
imagine we have some state that needs to
- 1:06
be computed into another value we can do
- 1:08
it like this in react but that value
- 1:10
will be unnecessarily recomputed every
- 1:12
time the component reeners it's
- 1:14
inefficient to address this react
- 1:15
provides a hook called use memo memo
- 1:17
means memoization which itself means
- 1:19
remember it wraps the computation in
- 1:21
another function which will only run
- 1:23
when the state that it's dependent on
- 1:24
changes which has to be explicitly put
- 1:26
in this array if we look at all the
- 1:27
other Frameworks though they don't do
- 1:29
stuff like this like in view we have
- 1:31
this computed function but there's no
- 1:32
need to include that dependency array
- 1:34
and in spell 3 it's even more simple
- 1:36
with the dollar sign syntax although
- 1:37
it's being replaced with a rune in spel
- 1:39
5 the reason these Frameworks can let
- 1:40
you write more simplified code is
- 1:42
because they have a compiler unlike
- 1:43
react which is purely runtime based they
- 1:46
look at your code in advance to figure
- 1:47
out where the reactivity is and bundle
- 1:49
that into the final product that goes to
- 1:51
the browser but now that react is
- 1:52
getting its own compiler it means hooks
- 1:54
like use memo and use callback are a
- 1:56
thing of the past and that's huge
- 1:58
because not only is the code ugly as as


