HomeVideos

React Conf 2025 Keynote

Now Playing

React Conf 2025 Keynote

Transcript

1170 segments

0:00

(upbeat music)

0:02

- Good morning.

0:17

It's great to be here.

0:18

It's a lot of first time React Conf attendees.

0:21

That's awesome.

0:22

So again, my name is Joe Savona.

0:26

I'm on the React team at Meta.

0:29

We've got a lot of awesome things to share with you today.

0:31

But before we dive into the new stuff,

0:33

at last year's conference,

0:36

we announced the release of the release candidates

0:38

of React 19.

0:40

Things didn't quite go as we intended.

0:44

During the release candidate period,

0:49

we got feedback from several folks in the community

0:52

about one particular change included in the RC.

0:57

So the way that React handles rendering

0:59

when one sibling of a suspense boundary suspends.

1:02

In React 18, when one sibling suspended

1:08

because it was fetching data,

1:10

React wouldn't immediately show the fallback.

1:13

Instead, it would continue trying to render the other children,

1:17

which meant that if they were fetching data,

1:19

those fetches could be kicked off early.

1:21

And then at the end, we would finally show a fallback.

1:28

So this meant that we were fetching more data early,

1:31

which is good, but hurting the user experience

1:33

by delaying the fallback.

1:35

So for React 19, we wanted to show that fallback earlier.

1:39

But our initial approach meant that siblings

1:42

didn't re-render at all,

1:43

which could delay the loading of data.

1:45

So based on your feedback,

1:48

we've implemented something even better

1:50

than the original 18 behavior

1:52

or the original 19 RC behavior.

1:55

In React 19, when a component suspends,

1:58

we immediately show the fallback,

1:59

improving the user experience.

2:01

But rather than wait for that initial fetch

2:04

to resolve before we try other siblings,

2:06

we immediately schedule a pre-warming

2:10

of the remaining siblings.

2:11

So we're still showing the fallback,

2:13

but while that's happening,

2:14

we're starting to render pre-warm the other siblings

2:16

to fetch their data too.

2:18

So to summarize sibling pre-warming

2:21

allows React to show the fallbacks earlier

2:24

while continuing to prefetch as much data as possible early.

2:27

I'd like to give a huge shout out to Andrew Clark,

2:33

in particular,

2:33

who painstakingly implemented these optimizations.

2:36

Really incredible engineering work.

2:38

(audience applauds)

2:39

Yeah.

2:40

And I'd also like to thank those of you in the community

2:43

who flagged this to us and gave us this feedback

2:46

so we could improve React.

2:48

This is exactly why we released canaries

2:51

and why we have released candidates

2:53

to get this kind of feedback.

2:54

Now, another big change since the last conference

2:59

is to the React docs.

3:01

We've gotten a lot of feedback from many of you.

3:04

Appininated, passionate, sometimes angry,

3:09

rarely happy, feedback about the docs.

3:16

In particular about one aspect of the docs,

3:18

which is what do I do when a framework

3:20

isn't a good fit for my application?

3:23

So, we heard your feedback.

3:26

Maybe not as quickly as you might have liked.

3:28

Maybe it's somewhat begrudgingly,

3:31

but we heard it, we'd internalize it.

3:32

It took some time, we'd do like sit

3:33

and go on some long walks in process.

3:36

But based on your input,

3:38

we've added a new page to the docs

3:40

that walks through how to build a React app from scratch.

3:42

And this page highlights several great options,

3:46

including parcel, VIT and RS build.

3:48

So for both of these cases,

3:52

we'd like to thank everyone in the community

3:54

who gave us feedback.

3:55

And it helped make React our docs better for everyone.

3:59

So seriously, thank you.

4:00

Yeah, give yourselves a round of applause.

4:03

This is great.

4:04

This is exactly how open source is supposed to work.

4:06

So this is the process working, right?

4:08

So since 19, we released 19.1,

4:13

which includes support for owner stacks in development.

4:16

So this is a development only feature.

4:19

Now, you may be familiar with component stacks,

4:21

which kind of show you where in the UI tree

4:23

an issue occurred.

4:24

But often the issue might be occurring

4:26

because of a component created elsewhere.

4:28

And so owner stacks can give you

4:29

a bit more precise information about the source of an error.

4:33

So if you're debugging, definitely check out this API.

4:36

It's also been an exciting year for the community.

4:41

And I'd like to take a moment to celebrate.

4:44

Traditionally, when we look at, you know,

4:45

the community section of the keynote,

4:47

we share a whole bunch of download stats.

4:50

This year, by all accounts,

4:51

everything is looking really good.

4:53

And one number in particular stood out.

4:56

As of a few weeks ago,

4:58

React's lifetime download count on NPM has reached...

5:01

Wait for it.

5:03

I'll have to click.

5:05

Yeah.

5:06

Six billion lifetime downloads,

5:07

which is just a staggering number of downloads.

5:12

So thank you for continuing to use React.

5:16

Looking beyond React,

5:19

this year also saw a number of really exciting releases

5:22

in the community.

5:23

And in particular, this was the year

5:25

that server components became mainstream

5:28

and just achieved widespread support

5:30

throughout the ecosystem.

5:31

Expo, next, parcel, React Router, Redwood,

5:36

TANstack, VIT, Waku.

5:38

These are in alphabetical order

5:39

in case you have any questions around the prioritization.

5:44

Just keep it simple.

5:45

They all support server components.

5:49

So just really, really incredible to see this coming along.

5:52

Obviously, server components are not the right fit

5:54

for every application,

5:55

but it's incredible to see the level of support

5:58

this has throughout the ecosystem.

6:00

So we'd like to say thank you

6:02

to everyone working on these frameworks,

6:04

building libraries, creating tutorials,

6:07

teaching your colleagues,

6:09

answering questions and showing up here today.

6:11

React is nothing without the community.

6:14

So thank you all.

6:17

But in addition to those of us humans in the crowd,

6:21

we've also got some other folks showing up as colleagues today.

6:25

Since our last conference,

6:28

large language models and agents have dramatically improved

6:31

and are quickly becoming a common part of how we all work.

6:34

I'm sure many of you have different feelings about AI.

6:38

I certainly have mixed feelings.

6:40

LMs and agents are just clearly here to stay.

6:46

One early takeaway from experimenting with LMs and agents

6:49

is that what makes React great for humans

6:52

also makes it great for AI,

6:54

because it turns out our context window

6:57

is not that long either.

6:58

Thank you for those of you who laughed.

7:02

I appreciate it.

7:03

So React's declarative composable approach

7:10

helps us reason locally,

7:12

and this appears to work for AI as well.

7:14

So AI is new, it's scary, it's exciting,

7:18

it's a lot of things.

7:19

But ultimately, we see it as another tool

7:21

to help us deliver on our mission,

7:24

which is to make it easy for anyone

7:27

to build great user experiences.

7:29

It's just another tool like linters, auto-completion,

7:33

or developer tools.

7:34

All right.

7:37

So that's an update since last time.

7:42

Next, I would like to share what we've been working on

7:45

this year.

7:46

Our work this year has focused on two key themes

7:48

in service of that mission.

7:49

Reasing the bar for responsive user experiences.

7:53

We've got some really, really amazing stuff

7:56

to show you this year.

7:58

And yeah, this just continues to kind of push the ceiling

8:01

of the kind of user experience we can deliver.

8:03

And at the same time,

8:04

we've worked to lower the barrier to entry.

8:07

It isn't enough that we have these amazing features.

8:10

We want to make sure that everyone can take it full advantage

8:12

of them.

8:13

So with that, to talk through some of our latest features

8:17

on responsive UI, I'd like to hand things over to Mofe.

8:20

(upbeat music)

8:24

- Hey everyone.

8:30

I'm Mofe, I work on the React team at Meta.

8:34

Super excited to be here today.

8:36

Wow, that's a lot of people.

8:39

In case you haven't heard about the latest news in React,

8:41

I love to tell you.

8:42

We're actually, hang on.

8:43

Maybe it's easier if I just,

8:45

what's new in React?

8:48

React 19.2.

8:54

(audience applauding)

8:59

So we just released React 19.2 last week.

9:01

And as you see, everyone's talking about it.

9:04

This is own news to you and you've already upgraded.

9:07

Great, thank you.

9:08

Without let us know what you think.

9:10

If you haven't, well, I'll bet you want to after today.

9:13

React 19.2 has a ton of exciting new features.

9:17

First, we have two new APIs in the runtime,

9:20

activity and use effect of it.

9:22

We also added partial pre-rendering and performance tracks,

9:25

which are new capabilities for React servers and dev tools.

9:28

First, let's talk about activity.

9:31

This feature has a lot of depth,

9:33

so we're going to spend most of our time here.

9:36

Activity lets you hide and restore the UI

9:39

and internal state of its children.

9:41

You can pass it a mode hidden or visible,

9:43

and children which react to a hide for reveal.

9:46

Now, some of you may be wondering

9:47

if you can just do the same thing with CSS,

9:50

like setting display none.

9:52

I want to show you the most exciting part of this feature,

9:55

because activity is not just about setting visibility

9:57

in the DOM.

9:59

We're going to walk through it

10:00

by using it in a very simple movie app.

10:04

Well, first, look at how the app performs with that activity,

10:07

add activity, and then compare.

10:09

So without activity, this is the root component of my app.

10:14

I have a client-side router,

10:15

which lets you navigate between movie gallery

10:17

and a movie detail, depending on which route is selected.

10:21

We always return both movie gallery and a movie detail

10:23

and manually hide one of them with CSS.

10:26

We also have a theme provider,

10:28

which is shared between both views.

10:30

Since setting light or dark theme

10:32

should affect my entire app.

10:34

So this is the app.

10:37

Let's talk about why we're always returning both views,

10:40

both gallery and the detail view.

10:42

Because I want to have a single application

10:44

with Persisted State,

10:46

I want to be able to edit the search filter,

10:49

click into a movie detail,

10:50

got to wait for the load,

10:53

and then navigate back.

10:55

When I navigate back,

10:56

I want my changed search filters to still be there.

10:59

I could write my own resumption logic,

11:01

but I can get really complicated.

11:03

So with this, I don't have to wait.

11:06

I don't have to set the search filter.

11:10

I also don't have to wait for an entire page load

11:12

on every navigation.

11:14

Since the other page is always available,

11:16

they've navigating back and forth is super fast.

11:19

We can even re-render in the background,

11:20

like if the user hovers a VR movie card.

11:22

Okay, so now we'll walk through a user interaction,

11:26

and I want to see how this app performs.

11:28

We can reset the app to the details view,

11:31

declutters and visuals,

11:32

and also add a timeline at the bottom

11:34

to visualize when React is work.

11:36

So say the user clicks to toggle the theme.

11:40

A click event handler will run and do two things.

11:44

First, it runs a blocking render

11:46

to show immediate feedback to the user.

11:48

So on the right, we'll draw the work-in-progress component tree

11:51

for this render,

11:53

and that's the highlighted theme toggle button.

11:55

On the bottom, we can see time-submit rendering,

11:58

one time slice for each component.

12:01

This render finishes very quickly,

12:03

and the work-in-progress tree paints to the DOM.

12:05

So we're going to show time-submit

12:11

converting on purple on the bottom.

12:12

So the second thing that happens

12:16

is that React will schedule a full theme refresh

12:20

to change the entire app to light theme.

12:23

And that's a lot of work that runs, right?

12:25

We're painting both the hidden view,

12:29

the gallery view, and the detail view to light theme.

12:34

And when this render is finally done,

12:36

React can commit and paint.

12:37

So if we were to look at the performance of this theme toggle,

12:44

IMP is good because we're following React best practices,

12:47

we're placing expensive updates inside of transitions.

12:50

But if we looked at how long it took

12:52

to actually show my page in light theme,

12:54

well, that's not as good.

12:56

This had to wait for every component to update,

12:58

even ones that we know are not visible.

13:01

So can we do better?

13:03

Step one's done.

13:06

Let's change the app to add activity.

13:08

First, we'll import it,

13:10

then replace this manual stuff with activity,

13:14

and then, wait, that's all, we're done.

13:17

Moving on.

13:18

So what's the performance of the same theme toggle interaction

13:23

now that we're using activity?

13:26

To better understand what's going on,

13:27

we're actually going to sit at the bottom timeline view

13:30

to show different priority levels

13:31

used by the React Scheduler.

13:32

We'll first show time spent rendering visible content.

13:37

This is blocking renders, updates from transitions,

13:40

really anything that's affecting content on screen.

13:42

And also time spent working on activity hidden components.

13:47

Because React knows the activity hidden components

13:49

can never be seen by the user,

13:51

it would differ updates to that content.

13:54

So hidden is React's lowest priority level.

13:58

It runs when there's truly nothing else to do.

14:00

Okay, so let's get to it.

14:03

Again, we receive a click from the user

14:05

to toggle the color theme,

14:06

and the exact same event handler runs.

14:09

We first re-render and paint to show immediate feedback,

14:12

and then we actually start updating the app to light theme.

14:16

And this is where it starts to get interesting.

14:18

Because remember that we wrapped the gallery view

14:21

in an activity hidden component.

14:24

This work will get deferred until there's nothing better to do.

14:27

And React will also schedule a higher priority render

14:31

to update just the visible part of the screen.

14:33

And that's what immediately runs.

14:35

And commits.

14:39

So now this is a much better experience than before.

14:42

It took less time to change the light theme

14:44

because we didn't also have to update the hidden view.

14:47

Now that there's nothing better to do,

14:49

React will start rendering the gallery view

14:52

in the background.

14:53

First search bar, coloring the border.

14:57

But wait, React is fast,

15:01

but this user is like really good at clicking.

15:03

They move their mouse and we receive another click of it.

15:07

This click happened in the middle

15:08

of the hidden priority work.

15:10

So we'll defer that to prioritize showing

15:13

an optimistic rating update.

15:15

This finishes super fast.

15:18

And again, when there's nothing else left to do,

15:21

React will resume the activity hidden work that was interrupted.

15:24

This time it completes and finally commits

15:30

the hidden gallery view, now in the light theme.

15:32

So if we look at the performance of this interaction,

15:36

INP stays low and the total time to paint a theme toggle

15:39

is also much faster.

15:41

If I were to compare the activity version

15:44

of my app with the original one, it's much faster now.

15:49

So, activity is not just about visibility,

15:54

it's a lot more than that.

15:56

To summarize, activity hidden components

15:59

are visually hidden, update with the lowest priority,

16:03

persist, react, and DOM state,

16:05

and their effects are left unmounted

16:08

so the inactive parts of your app

16:10

don't need to pay for expensive synchronization.

16:12

And they're also not server rendered or hydrated.

16:18

Of course, activity visible components

16:20

are visually visible and rendered with the default priority.

16:23

So if you want to learn more about how to use activity

16:27

and how it integrates with newer features,

16:29

be sure to check out Chan Strickland's talk later today.

16:32

Okay, so let's talk about the other parts of React 19.

16:38

Use Effectivit is a new API we're releasing

16:40

to give users more fine-grained control over their effects.

16:44

It's a more advanced hook,

16:45

so be sure to read through the docs

16:47

if you're planning to use it.

16:48

19.2 also adds a new server feature

16:53

called partial pre-rendering.

16:54

This lets you render the static parts of your app

16:58

and serve it from a CDN.

17:00

Then later, when resolving a client request,

17:02

we can resume rendering the shell to fill it in

17:05

with dynamic content.

17:06

What this means is that server-side renders

17:09

can use cache resources to let the user see a shell much faster.

17:12

And finally, we're releasing a new profiling tool

17:16

called Performance Tracks.

17:18

This lives in the Chromium Performance Panel,

17:21

unless you see a timeline of all the work done in React.

17:23

The schedule of the track is a more detailed version

17:27

of the timeline view we just used to understand activity.

17:30

Blocking, transition, suspense, and idle,

17:33

those are all different priorities

17:34

used by the React Scheduler.

17:36

And the component track gives you a flame view graph

17:40

of component renders and effects.

17:42

If you want to understand how to use performance tracks better,

17:45

please check out Rustman's talk.

17:47

So this sums up what's new in React 19.2.

17:52

To tell you more about what's coming in React,

17:54

I hand you off to Jack Pope.

17:55

(upbeat music)

17:59

- Thank you, Mofe.

18:07

Let's give her one more round of applause.

18:09

(audience applauding)

18:13

Hey everyone, my name is Jack.

18:15

It's so great to be here today.

18:16

If you're wondering what the team's working on next,

18:21

it's a good question.

18:22

And frankly, as a new manager,

18:24

I wonder the same thing every morning when I wake up.

18:27

Are they actually working,

18:30

or just adding cabbies to my slides?

18:32

So I grilled them, and this is what they told me.

18:36

It's been a really ambitious year for our team,

18:40

and our work doesn't stop at React 19.2.

18:44

In fact, React uses multiple stages and release channels

18:47

to allow features to move from ideas into public APIs.

18:52

So as we begin running experiments,

18:54

we'll release features into experimental.

18:56

And after they're well tested there,

18:59

they may graduate into Canary.

19:01

Now, Canary is the last stop for a feature

19:05

before it could make itself into a somber stable release.

19:08

So I really encourage any framework

19:10

or library authors out there in particular

19:13

to keep an eye on Canary and provide feedback

19:15

when things land there.

19:16

Now, speaking of Canary,

19:20

I am thrilled to announce

19:21

that the team landed two new features here yesterday.

19:25

After many years of research

19:27

and some amazing feats of engineering

19:29

by Sebastian Markbage,

19:30

I'm thrilled to announce that view transition

19:33

is now ready for you to try.

19:35

(audience applauds)

19:40

And additionally, we've added rest of fragments

19:43

to power a new composition model for platform APIs.

19:46

(audience applauds)

19:50

So I'm gonna start with view transition,

19:52

but before we get into the specifics of the API,

19:55

let's take a moment to go over animated transitions.

19:58

So animated transitions visually connect

20:02

our changes in the UI.

20:04

They help the user understand what's happening

20:06

and where to focus their attention.

20:09

So page navigation animations like this one

20:12

can provide a sense of place in the application.

20:15

It's easier to understand where you're going

20:17

and where you've been.

20:19

And in another example,

20:22

this element can animate from one view into another.

20:26

And animations like these create a sense of continuity.

20:29

Rather than a large modal just flashing in

20:32

and taking over the page,

20:33

we can reduce some of the cognitive load

20:35

by anchoring that UI change.

20:39

One last example is the reordering of items in a list.

20:43

When your order changes instantly,

20:45

it might be hard to tell exactly what just happened.

20:48

But with animated reordering,

20:50

it's much easier to follow along.

20:52

Now historically, high quality animations like these

20:56

have been really difficult to achieve.

20:59

When I worked on Instagram.com,

21:01

I had designers all the time requesting features

21:04

just like these.

21:05

And I always wanted to build them.

21:07

But due to the complexity and some of the performance trade-offs,

21:11

they'd always just end up getting cut at the end of a project,

21:14

leaving me super frustrated.

21:16

And then in 2023, Chrome released the View Transition API.

21:22

And I was really excited by all the demos they showed

21:25

and all the promise of native browser support.

21:28

Finally, with just a few lines of JavaScript and CSS,

21:33

we can animate transitions on both single

21:36

and multi-page applications.

21:38

The browser creates snapshots of the UI, runs your callback,

21:42

and then animates to the new UI using CSS animations.

21:47

And this is a really powerful primitive,

21:49

but there can be a few problems

21:51

with using Star View Transition directly,

21:54

mainly with timing and scoping.

21:56

So it can be difficult to snapshot at the right time.

22:02

With React, if you use this directly,

22:04

you need to use React DOM/Sync API

22:07

so that the DOM can update immediately

22:09

with your new state applied.

22:12

And this would unfortunately just deopt any concurrent rendering

22:16

that may have been part of this update.

22:18

So if you're doing something async,

22:21

say a page navigation that has to load in new data,

22:24

you'll end up animating to force fallbacks

22:27

rather than your final content.

22:29

And to understand scoping,

22:32

let's take a look at this gallery interaction.

22:35

By default with Star View Transition,

22:39

the entire route will animate,

22:41

causing your page to be non-interactive in the meantime.

22:44

And you can get around this

22:46

by adding view transition name attributes

22:48

to the specific elements that you'd like to animate.

22:52

But if you leave these around,

22:53

they could get picked up by future,

22:55

potentially unrelated view transitions.

22:58

And so it's important to add them at the time of the update

23:02

and clean them up.

23:03

But what if React could just solve all of these problems for you?

23:07

So me view transition, a new component from React.

23:13

It's the first animations API built directly into React

23:16

and is deeply integrated with all of our features.

23:19

View transition is a declarative API

23:22

that uses a set of heuristics

23:24

to determine what and how to animate.

23:29

And here we can see the immediate difference in the programming model

23:32

when using the view transition component.

23:35

React handles applying the view transition name

23:38

as well as removing it.

23:40

And it will also call Star View Transition for us

23:44

at just the right time.

23:45

Additionally, it handles our scoping problem.

23:49

Because React manages all of the view transition names,

23:53

it can decide which elements to activate

23:55

when an update comes through.

23:58

And it will activate the smallest subset

24:00

of view transition components necessary based on that update.

24:04

So in our gallery here,

24:06

we'll only animate the movie poster in the center

24:09

and leave the rest of the page open for a responsive interaction.

24:13

So that's what to animate.

24:16

But how about when?

24:18

How would we trigger this view transition?

24:19

The triggers here are start transition,

24:24

use deferred value, and suspense.

24:27

And through these APIs,

24:29

React's concurrent rendering model

24:31

integrates seamlessly with your animations.

24:34

And that brings along all the benefits of bashed updates

24:37

and our async coordination.

24:38

So in the gallery example,

24:42

clicking the next button,

24:44

we'll call a start transition with an async action.

24:47

The router change would update the current movie index,

24:51

resulting in a dummy mutation

24:53

to switch out that movie poster.

24:55

The view transition component will detect the mutation

24:58

of its child and activate an update animation.

25:01

Now, without specifying any class names here,

25:05

the browser's default animation will be used

25:07

typically across fade.

25:09

And we could customize the effect further

25:12

by adding the update class name,

25:15

and then using CSS to style the view transition pseudo elements.

25:19

And additionally,

25:23

we might want to customize based on the type of interaction

25:26

that triggered our update.

25:28

So in the case of the gallery,

25:30

there's two possible interactions here.

25:32

We can click next or previous.

25:34

And if we wanted that element to slide to the right

25:37

or left just like this,

25:38

depending on which type of action we took,

25:41

we can do so by using a new API, add transition type.

25:46

So let's see what using add transition type looks like.

25:52

Within our action,

25:54

we'll just add the next movie poster type.

25:57

And then within our view transition component,

26:01

we can replace that update class name with an object.

26:04

Here, the keys align to transition types,

26:08

which then map to our class names.

26:11

And now we can use CSS to create that sliding effect

26:14

to the right or left, depending on each class name.

26:17

So far, I've been describing update animations,

26:22

but there are three other categories.

26:25

We also have enter animations,

26:27

which trigger when a component with view transition

26:29

at the top level is mounted,

26:31

revealed from suspense, or revealed from activity.

26:34

We have exit animations.

26:38

When a component with view transition at the top level

26:41

is unmounted or hidden with activity.

26:43

And finally, my favorite part,

26:48

we have share animations.

26:50

With share animations, we can implement magic move-like effects

26:54

with just a few lines of code.

26:56

These activate when you have a pair of view transition components

27:01

that have matching names, and one is hidden

27:04

while another one appears in the same update.

27:06

So with enter, exit, update, and share animations

27:13

powered by react transitions and suspense,

27:15

there is so much possibility.

27:17

And this truly raises a ceiling on UX for react applications.

27:21

(audience applauds)

27:25

So as Mothane mentioned,

27:30

chances gonna be speaking more about view transition

27:33

right after the keynote, so be sure to stick around for that.

27:36

Now, that wraps up view transition.

27:40

As Joe told us earlier, we don't just wanna make it possible

27:45

to create great applications with React.

27:47

We also wanna make it easier to do so.

27:50

And that brings me to fragment refs.

27:52

With fragment refs, we're introducing a new way

27:56

to compose platform behavior that can significantly

28:00

lower the complexity of your product code.

28:02

Because as we review product code,

28:05

we observe a lot of friction

28:07

when it comes to working with platform APIs.

28:09

I'm talking about things like setting up event listeners,

28:14

attaching intersection observers,

28:16

maybe applying focus, et cetera.

28:19

And there are a handful of APIs and patterns

28:21

used to achieve this today.

28:22

But it can be difficult to compose this behavior.

28:26

We see a lot of different framework level abstractions,

28:29

doing things with custom hooks, render props,

28:33

higher order components, components that make you

28:36

wrap another div or other element around your children

28:38

to take a ref in the right place.

28:42

So let's take a look at an example.

28:44

Here we have a scrollable movie grid,

28:46

which needs a mon scroll behavior.

28:48

So in fairly typical fashion, we'll create a ref

28:52

and then use a use effect to call add event listener

28:55

and remove event listener,

28:56

and finally pass that ref down to the movie grid.

28:59

Now thanks to hooks, this type of behavior

29:03

can already be shared amongst components

29:05

and many apps are doing this today.

29:08

So here we've created a custom hook abstraction

29:10

called use event handler,

29:12

and this returns a ref that you can then pass to any element.

29:15

So if we go back to our component and refactor,

29:20

we can see that things are greatly simplified.

29:22

But what happens when we introduce additional behavior?

29:27

For example, here we're also adding a use impression hook

29:31

because we need to log an impression

29:33

whenever a movie grid enters a viewport.

29:35

And we're also taking a ref from the parent

29:38

and forwarding that down to movie grid as well.

29:40

So now we must merge the refs.

29:42

And in many examples we see in production apps today,

29:47

it's far more complicated than this.

29:49

We have a mix of patterns.

29:51

Many of them force you to wrap extra layout elements

29:54

around your children,

29:55

and we'll pass multiple refs around the tree

29:58

merging them at various levels.

30:00

Could there be a better way to handle this complexity?

30:03

Enter fragment refs.

30:06

We believe that when it comes to platform APIs,

30:09

the vast majority of logic and the effects and refs

30:13

that power them can live in shared abstractions.

30:16

And then product code should easily be able

30:18

to compose this behavior as needed.

30:20

Fragment refs make this possible

30:23

and offer a new way to compose platform capabilities.

30:26

The ref value in the case of a fragment

30:30

is called a fragment instance.

30:32

And a fragment instance exposes a series of operations

30:35

to help you leverage platform APIs

30:37

without breaking encapsulation.

30:39

So on the fragment instance,

30:42

we have a series of operations,

30:44

such as event operations, like add event listener,

30:48

remove event listener, dispatch event.

30:51

We have layout operations,

30:53

such as compare document position, get client racks.

30:57

We can do focus management with focus and blur.

31:03

And we can attach intersection or resize observers

31:06

to our children using observe using.

31:09

For a full list of these operations,

31:12

please check out the docs.

31:14

So let's go back to our scrollable movie grid

31:20

and now take advantage of fragment refs.

31:23

Here I've created two fragment based components

31:27

that implement the same behavior we saw earlier,

31:30

but under the hood, taking advantage of those fragment instances.

31:33

So we have a scroll handler fragment,

31:37

which we simply now pass an on scroll handler

31:40

and let it do the rest.

31:42

And we have an impression fragment

31:44

where we can pass a callback

31:46

that'll be triggered every time the movie grid

31:47

enters a viewport.

31:49

So we can achieve this functionality,

31:52

just like we started with,

31:54

without having to think about effects

31:56

or refs locally within the product code.

32:01

And additionally, since we remove find DOM node in React 19,

32:05

some apps have still had difficulty

32:07

interacting with components they don't own.

32:10

Maybe these components are user defined

32:13

or they might come from a design system

32:15

that you don't have full control over

32:16

to update to take a ref just where you need it.

32:19

But with fragment refs,

32:21

we can interact with the host nodes

32:23

rendered by any component.

32:26

In this example, we focus this input component

32:29

that came from a third-party library

32:31

just by wrapping in a fragment

32:33

and calling focus on that fragment instance.

32:35

So to summarize, fragment refs offer

32:39

a powerful new composition pattern in React.

32:42

And platform capabilities can be integrated

32:45

at the framework, library, or design system levels,

32:49

and then used throughout your product code.

32:51

And that's without requiring additional element wrappers

32:54

or even having control of your child components.

32:59

So as you can see,

33:00

we have a lot of exciting new features in React.

33:04

As Mofe shared, React 19.2 released last week with activity,

33:09

use effective and performance tracks

33:11

and partial pre-rendering.

33:13

And as of yesterday in Canary,

33:16

we now have view transition and fragment refs.

33:19

And additionally, we're still in early research

33:23

and development of a number of other features.

33:25

These are things like suspense lists, concurrent stores,

33:29

gesture animations, and much more.

33:32

And we'll be thrilled to share updates on those

33:35

as soon as we have more to share.

33:37

So I'm so excited to see what you build

33:41

with everything new in React.

33:43

And with that, I'm gonna hand it off to Lauren

33:45

for an update on React Compiler.

33:47

(upbeat music)

33:55

(upbeat music)

33:58

Hello.

34:00

Can I get a quick show of hands?

34:05

Who loves hydration?

34:07

Hydration there is great.

34:11

And that's why I'm gonna hydrate myself right now.

34:15

And we should all hydrate as well.

34:17

Stay hydrated.

34:18

Okay, thank you, Jack.

34:24

It's really great being back at React Comp.

34:28

And we have so much to share with you today

34:29

and not a whole lot of time.

34:31

So let's get right into it.

34:32

So the first thing I wanna talk about

34:39

is pretty serious, okay?

34:42

Need all of you to take this seriously,

34:44

put your phones down, put your laps up down,

34:47

put your water bottles down, we're done hydrating.

34:51

Are you all ready?

34:55

Very excited to announce.

34:57

(audience applauding)

35:01

Very excited to announce React Compiler is now available.

35:08

You can't NPM install yet.

35:10

We'll release that later today.

35:12

So don't take your laptops out.

35:14

But yes, very exciting milestone.

35:17

And so many people contributed to the compiler

35:21

over the past couple of years.

35:22

And we really appreciate all of your efforts

35:24

bringing their compiler to life.

35:26

So can we get a big round of applause for Joe, Mofe?

35:30

And of course, thanks to me as well.

35:32

(audience applauding)

35:35

So after the keynote and after I do the release,

35:42

you can get started using the compiler

35:44

and your applications by installing

35:46

Babel plugin React Compiler,

35:48

as well as the new ESLent plugin.

35:51

The plugin has new compiler powered rules,

35:54

which are independent of the compiler.

35:57

So even if you haven't adopted the compiler yet,

36:00

the linters new rules will work out of the box

36:03

to help you find a rule of React violations

36:05

that you should probably fix.

36:07

And an important note, if your ESLent config

36:11

previously only specified exhaustive depths

36:14

and rules of hooks, you wanna update your config

36:18

to reference the recommended rule preset

36:20

so that you get all of the new rules

36:22

as well, otherwise you might not actually see them.

36:24

Now, I don't know if there's anyone

36:28

who hasn't heard about the compiler,

36:30

but if you're seeing their confused,

36:31

like what is she talking about?

36:33

The compiler is a build tool that works

36:37

on every platform that can run React.

36:39

It auto-optimizes your components in hooks

36:43

and lets you focus on what really matters.

36:45

It's also designed to work out of the box

36:49

without any code rewrites, which is pretty cool.

36:51

And it works with the latest version of React 19

36:56

as well as 17 and 18.

36:58

So that's pretty cool, right?

37:01

(audience applauds)

37:02

Thank you.

37:03

So it's easy to think of the compiler

37:07

as something that just adds memorization for you,

37:11

but it's much more than that.

37:13

It also deeply understands your code

37:15

and helps you write better React.

37:17

So make sure you download the ESLint plugin

37:20

and check that out after the talk.

37:24

So one thing as well, I don't think is appreciated enough

37:29

is that you can use the compiler anywhere

37:31

where you can use React.

37:33

So for example, last year at React Conf,

37:36

I did a live demo of adding the compiler to BlueSky,

37:39

which is an Expo app.

37:40

So the same BlueSky product code

37:43

runs on both web and mobile.

37:46

And thankfully, after the talk,

37:48

I submitted a PR to BlueSky.

37:50

And thankfully, it got merged.

37:52

Thank you, Dan, for reviewing my code.

37:55

(audience applauds)

37:56

So BlueSky was actually the first application

38:00

outside of Meta to use the compiler in production

38:02

all the way back in May 2024.

38:04

So they were on the bleeding edge.

38:07

And I just think that's so exciting to see

38:10

the richness of the React ecosystem

38:12

where you see React running across

38:15

so many different types of screens,

38:17

like web, mobile, TVs, even your terminal

38:20

or your refrigerator.

38:22

And the exciting thing is that React compiler

38:25

can run on all of them as well.

38:27

But let's take a quick look at automatic memorization as well,

38:32

like what exactly does that mean?

38:34

So one of the core premises of React

38:38

is writing declarative code.

38:40

You write code that describes what your component does

38:42

and then React handles the rest.

38:44

And if you look at this code,

38:45

it's fairly simple to understand.

38:47

The component receives some data,

38:49

it processes it, then it renders each item

38:52

and then you can click on each item.

38:54

Now, while React is fast enough

38:57

in the vast majority of cases,

38:59

you do run into situations

39:00

where components just re-render too often

39:04

that it can hurt performance.

39:06

So for a moment, let's just all pretend

39:08

the compiler doesn't exist.

39:11

I haven't given this talk yet.

39:13

And you've profiled your application

39:15

and you found that this component

39:17

is just rendering way too much.

39:19

So if you wanted to solve this problem today,

39:22

you'd have to reach for our best friends,

39:25

use memo, use callback and React.mail.

39:28

But it's really easy to get wrong.

39:31

It's also difficult to maintain over time

39:33

and it just looks kind of ugly, right?

39:36

And if you look at the code,

39:38

look at the boxes that I drew,

39:39

you actually see that I forgot to memoize something.

39:42

Can anyone spot it?

39:43

Anyone?

39:44

See my bug?

39:46

It's hard, right?

39:49

It's over here.

39:50

Of course, you used an arrow function.

39:53

This recreates the function on every render.

39:55

So we missed the case.

39:56

But the really nice thing about the compiler

39:59

is that you can just forget what I just said,

40:01

like you don't have to remember that.

40:03

And it lets you go back to writing your code

40:04

in a very natural way

40:06

and the compiler just takes care of the rest.

40:08

And even, yeah.

40:10

(audience applauds)

40:13

And it even handles that arrow function for me.

40:17

So I don't have to change the way that I write my code.

40:20

We can just write our apps in the same declarative way

40:23

that makes React so intuitive

40:24

and let React and the compiler work behind the scenes

40:28

to keep our apps fast and responsive.

40:30

So automatic memoization.

40:34

Very nice win.

40:36

It's gonna save so much time,

40:38

let you delete a lot of code,

40:40

and you just get a performing app out of the box.

40:43

You don't have to rewrite anything.

40:45

And even if you're not on the latest version of React,

40:47

it gets to used to compiler.

40:49

But the thing I'm excited about

40:51

is that the compiler is more than just a tool

40:53

for adding memoization.

40:56

And later today, you'll see Cody from Sanity

40:59

share a case study of how he's been using the compiler's

41:02

linter to find some latent issues that were hiding

41:05

in their large and complex React application.

41:08

But let's take a look at some of them as well.

41:11

So the compiler uses a steep understanding of your code

41:18

and its knowledge of the rules of React

41:20

to provide detailed diagnostics

41:23

and a cat arresting you for breaking the rules of React.

41:27

No, that's not actually a feature.

41:29

Not yet, at least.

41:31

And here you'll see that there's a pattern

41:34

that's actually really bad for performance

41:36

where you call set state inside of an effect.

41:39

Now, if you're not familiar with this pattern,

41:42

the reason it's bad is because the effect runs after

41:45

React commits the changes and then it schedules

41:49

another render through set state.

41:51

And that's really, really inefficient.

41:53

But the really great thing is that the compiler

41:55

and the linter can detect cases like this

41:57

and warn you and flag them to ahead of time.

42:01

So for example, here we can see that the linter

42:04

tells us that, hey, don't do this

42:06

and instead calculate the value of full name during render.

42:11

Let's look at another example.

42:15

If you've ever used a ref in React,

42:17

you'll know that it lets you remember some information

42:20

and whenever the information gets updated,

42:23

it doesn't re-render the component.

42:26

But since React doesn't know when the ref changes,

42:29

even reading it while rendering

42:30

can cause some unexpected behavior in your component.

42:35

And this is another case with the compiler

42:37

can detect this pattern and tell you

42:39

that, hey, you've accessed a ref during render

42:42

and that you probably shouldn't do that

42:44

or you'll be arrested by the cat.

42:46

So let's look at something a little more interesting.

42:51

So most people know, I hope,

42:53

that you shouldn't call set state in render

42:55

because set state doesn't run immediately.

42:58

It queues up an update for the next render,

43:01

which means that this code will lead to an infinite loop.

43:04

And you can see that the compiler will tell you

43:07

exactly that, that this code causes an infinite loop.

43:10

But the code we've been looking at

43:13

has been pretty simple so far.

43:16

What if we could trick the linter

43:17

by wrapping our set state in a function?

43:21

Like, can the linter still detect this?

43:23

And unfortunately, yes, it still can.

43:26

So we're all going to jail.

43:28

And this is where the compiler's deep understanding

43:32

of your code comes into play.

43:34

The compiler is built with an architecture,

43:36

so much as something you might see

43:37

and say the Chrome V8 engine.

43:41

And what that means is that the compiler's analysis

43:43

isn't just limited to syntactical problems.

43:47

It actually knows here in this example

43:49

that calling on click in render

43:51

is actually calling set state in render.

43:54

And it does this through very careful compiler passes

43:57

that track all of the different values

43:59

as they flow throughout your component.

44:01

Another pattern that we've seen

44:04

that's actually pretty dangerous and easy to make a mistake

44:08

is when you call set state during render,

44:10

but the setter comes from the parent.

44:12

So in addition to the compiler's analysis,

44:16

it can also make use of other shearistics

44:19

to determine if code is safe or not.

44:21

And here, we rely on the naming of the function

44:24

to infer that it might be calling set state

44:26

from a parent in render.

44:28

And in practice, we found this assumption to be really useful,

44:31

and this was actually inspired by a real self

44:34

or outage at meta, where someone accidentally called

44:37

a set state in render and crashed the application.

44:41

So that's been a lot, and there's a lot more rules

44:47

that I can show you as well, but we don't have a lot of time.

44:51

And, you know, make sure you download the ESM plugin.

44:55

And we can maybe find you some, you know,

44:58

some issues that are hiding in your application.

45:00

So that's a glimpse of what React compiler is.

45:05

It's what we think the future of how React apps are built.

45:10

It raises the floor for performance,

45:12

it makes your product code so much easier to write and maintain.

45:15

But again, the most exciting thing about the compiler, for me,

45:19

is that it's a platform for us to build

45:20

more and more intelligence and static analysis

45:24

to help humans and maybe even AIs write better React code.

45:28

And so our official recommendation is that all new applications

45:33

should start using the compiler from day one.

45:36

We recommend existing applications used to compiler

45:39

and adopt a compiler as well, but it's okay to take your time.

45:43

Just not too much time.

45:46

And again, for the eighth time, all apps should use the linter

45:51

because it's independent of the compiler.

45:53

And even if you're not quite ready to roll out the compiler

45:56

to, you know, get your production,

45:58

you can still use the linter and get all of those benefits

46:02

in your application.

46:03

For existing apps, we've written a new guide

46:06

on how to adopt the compiler incrementally.

46:08

So you can roll that out to your users with confidence.

46:12

And I highly recommend checking these docs out

46:15

because I wrote it, so please, please read it.

46:19

Thank you.

46:20

(audience applauds)

46:23

And okay, if you're sitting there, like, you know,

46:28

can I really trust, learn up here, refer jokes and all?

46:32

But if you watched React Con class here,

46:36

Mofe actually shared these numbers last year

46:38

about our experience using the compiler

46:40

on some meta applications.

46:42

So here, these numbers are from the meta quest store,

46:45

the store where you purchase apps for the meta quest.

46:49

And there, we saw initial load and cross page navigations

46:53

improved by up to 12%.

46:55

And some interactions were even more

46:57

than twice as fast as before.

46:59

And this all happened while memory usage stayed neutral.

47:03

While we definitely can't guarantee the same results

47:08

or similar results for your application,

47:10

this app was very carefully manually memorized.

47:15

So we do recommend trying out the compiler, you know,

47:17

and seeing if it actually gives you some nice wins,

47:20

even if you've already spent a lot of time

47:22

with manual memorization.

47:24

As part of the stable release,

47:27

we've also worked with the Expo, Vte, and Next.js teams

47:31

to either enable the compiler by default for new applications,

47:35

which is the case for Expo,

47:38

or expose an option for you to pick a React compiler

47:40

enabled template, which is the case for Vte and Next.js.

47:45

We highly encourage everyone to start your application

47:48

with the compiler so you can get all of those benefits

47:50

from day one and just really focus on building out,

47:52

you know, features that your users want

47:55

instead of just worrying about memorization.

47:57

And again, if you're not using one of those frameworks,

48:00

you can install the compiler packages directly.

48:06

So, couldn't resist.

48:10

With this same release,

48:13

compiler is now a foundation for the future of React.

48:17

And over the coming years,

48:18

we expect to see more and more React features

48:21

that build upon both the compiler and the runtime

48:24

to just really raise the bar for developer

48:26

and user experience in writing React.

48:29

So I hope all of you get a chance to try the compiler

48:32

after the talk and maybe even ship it into production.

48:36

And if you run into any issues,

48:38

please look for any of us, Joe, Mofe, and myself,

48:42

or send us a DM on Twitter and we'll try to help you out.

48:45

And finally, be sure to check out both of these talk later.

48:49

Cody, again, is gonna talk about his experience

48:51

using the compiler as one of our earliest adopters.

48:54

And then Joe is gonna share some explorations

48:57

about performance that we've done.

48:59

And that's really exciting.

49:02

So thank you very much for listening

49:04

and tolerating my horrible jokes.

49:06

And I'd like to welcome Seth back to the stage.

49:09

(upbeat music)

49:11

- How's everybody doing?

49:30

And what do we think about those announcements?

49:32

(audience cheering)

49:34

It's pretty good, pretty good.

49:35

You know, last year when we had the conference,

49:37

we had five years of things to share,

49:39

but you can see the team has been hard at work anyway.

49:42

You know, at React Comp, we have a bit of a tradition.

49:45

We show you some of the most exciting, ambitious,

49:48

mind-bending demos across the ecosystem of our products.

49:51

And then just before we let you go,

49:53

we come out here and we're like, oh, there's one more thing.

49:59

Wait, what?

50:00

We don't do that.

50:04

Ah, Apple, September.

50:10

Got it.

50:10

Okay, last year I spoke to you guys from this stage

50:14

about the power of community.

50:16

The power of our community, the power of this community.

50:21

And it's true that since the beginning,

50:23

since we open source React, but in spirit before,

50:26

that the heart of what makes React React is our community.

50:30

React is your React.

50:32

Our community is the foundation of what makes React so cool,

50:36

so special, so capable.

50:39

And when I joined the team six years ago,

50:43

I knew I'd found something special.

50:45

Something bigger than technology, bigger than code.

50:49

I'd found a place to realize my lifelong North Star,

50:52

my lifelong ambition, which is to help others

50:54

bring their ideas to life.

50:57

I knew I had found a place to manifest.

51:01

In short, I had found something really special

51:03

long after many of you had discovered it.

51:06

After you'd been building for many years the bedrock,

51:09

the foundation of what makes React what it is today.

51:13

The most popular, declarative UI framework

51:17

in the history of software.

51:19

Huge.

51:21

You did that.

51:23

Google and Apple and Meta, not to mention the mobile

51:26

and web at large, have all been influenced by the ideas

51:30

that you have created.

51:31

That's a huge legacy to leave

51:34

when it comes to software history.

51:37

And I just wanna celebrate that you did that.

51:39

You know, otherwise React is nothing but a novel,

51:41

declarative, reconciling framework, a library.

51:45

And JSX is really cool, not to mention fast refresh

51:48

and code we just saw that optimizes itself,

51:51

but what the React community has built

51:53

is really some of the most amazing technology out there.

51:58

And without it, React is just basically some really cool,

52:02

really hard to read and impossible to understand code.

52:05

What brings it to life is you.

52:10

You are what gives us the energy every day to show up

52:13

and do everything we can with all of our hearts

52:17

and all of our blood and all of our sweat

52:19

and all of our tears to help other people

52:20

bring their ideas to life.

52:22

That React, this React, is bigger than us all.

52:26

And it is important to me and to you

52:31

and to the world that until something better

52:34

comes along, React is protected

52:36

and that it's bright, progressive, future is secured.

52:41

That it remains open, that it remains with our community.

52:45

So today, I am actually excited

52:50

and I do have one more thing to share with you.

52:52

I'm incredibly excited to announce

52:55

that we officially formed the React Foundation.

52:58

(audience applauds)

53:01

For nearly a decade, that has been

53:10

an incredible steward of React,

53:12

with love and sweat and no small amount of debate,

53:15

with incredible open source contributors, maintainers,

53:19

and the incredible community sitting in this room.

53:21

And around the world, of course,

53:24

but as React has grown into one of the most important

53:27

technologies in software history,

53:29

it needs a home built for the next 15 years and beyond.

53:34

The React Foundation will ensure

53:35

that React remains independent, community-driven

53:38

and built for everyone.

53:39

It gives React a structure that outlives

53:41

any one company person to or team.

53:44

It means that React's future is no longer just ours

53:47

to shape, it's yours.

53:50

This is a huge milestone for me personally.

53:52

I, in addition to so many others,

53:54

have been working on this for many years,

53:55

and the team has demonstrated incredible

53:57

internal adaptation to make this possible.

54:00

When we started on this path years ago,

54:02

we simply were not ready to operate as a foundation.

54:05

We'd been operating as a scrappy meta team, right?

54:09

With all the meta things that comes along with that.

54:11

And so over the past number of years,

54:13

as you've seen with the staging systems and the RFCs

54:16

and so forth, we've moved into a place

54:18

where we can now interface with the community

54:21

in a much more compatible way with the foundation.

54:25

This is a huge milestone for React.

54:29

It's also a huge milestone for open source as a whole.

54:31

It's a statement that the ideas that we develop

54:33

and build together deserve to last.

54:36

They deserve to grow and flourish,

54:38

and they deserve to belong to everyone.

54:41

So here is my invitation to you.

54:43

That alongside the generous support of Meta, Amazon, Expo,

54:47

Call Stack, Microsoft, Software Mansion and Vershales,

54:51

join us in shaping the vision and the future

54:54

of what it means to be a foundation with React.

54:58

React has always been about the people,

55:00

and now with you and the React Foundation,

55:03

it will always belong to you.

55:05

Crazy, intuitive, creative, beautiful people.

55:10

Thank you for getting us to this point.

55:13

(audience applauds)

Interactive Summary

The React Conf keynote covered a range of major announcements for the React ecosystem. Key updates include the release of React 19.2, which introduces features like Activity for UI state management, useEffectEvent, partial pre-rendering, and new performance profiling tools. The team also announced the React Compiler, now available for production, designed to automatically optimize component performance. Additionally, they introduced new Canary features like View Transition and Fragment Refs to simplify animations and component composition. Finally, the keynote concluded with the historic announcement of the creation of the React Foundation, an independent entity established to ensure the long-term stewardship of React.

Suggested questions

3 ready-made prompts