Evan Bacon – Fetch Once, Render Everywhere: React Server Components in Expo Router | App.js 2024

Software Mansion
10 Jun 202424:42

Summary

TLDREvan Bacon introduces Expo Router, a file-based framework that enables simultaneous web and native app development with familiar web APIs. It leverages React Server Components for cutting-edge server rendering across platforms, allowing for AI-driven UI generation and seamless client-server interactions. Expo Atlas, a new tool for visualizing and optimizing Expo bundle outputs, is also unveiled, promising faster iteration and better user experiences.

Takeaways

  • 📚 React Native has evolved significantly since its inception nearly a decade ago, becoming a leading framework for building client-side applications.
  • 📈 React Native powers hundreds of apps on the App Store's trending list daily, indicating its ongoing popularity and impact.
  • 🛠 Evan Bacon introduced 'Expo Router', a file-based framework for creating apps that function seamlessly on both web and native platforms.
  • 🔗 Expo Router utilizes familiar web APIs like 'link' and 'href' for navigation and supports nested routing for complex UI elements like tab bars and headers.
  • 📱 It leverages native primitives for navigation on Apple devices, ensuring a truly native feel and gesture experience.
  • ⚙️ With the collaboration with the Meta team, Expo Router benefits from the React compiler, reducing the need for 'useMemo' or 'useCallback' and simplifying code.
  • 🌐 The script highlights the limitations of client-side applications and the potential of server-driven UIs for performance and flexibility.
  • 🤖 The presenter demonstrates building AI-powered apps with Expo Router, showcasing server actions and concurrent routing with React Server Components (RSC).
  • 🎨 Expo Router's server environment is multiplatform aware, dynamically rendering platform-specific UI components based on the device's platform.
  • 🚀 The live demo illustrates the capabilities of Expo Router with AI integration, server-rendered elements, and interactive client-side components.
  • 🛠️ Expo Atlas was announced as a new tool for visualizing and understanding Expo bundle output, aiding in optimization and development of universal RSC.

Q & A

  • What was the initial premise of React Native when it was first announced?

    -React Native was first announced with a simple premise to bring the good parts of the web to mobile app development.

  • How has React Native evolved since its inception?

    -React Native has grown to become one of the most impactful frameworks for building client-side applications, powering hundreds of apps in the App Store trending list every day.

  • Who is Evan Bacon and what is his contribution to React Native?

    -Evan Bacon is an engineer and the creator of Expo Router, a file-based framework for building apps that work on both web and native platforms simultaneously.

  • What is Expo Router and how does it work?

    -Expo Router is the first file-based framework for creating navigation for both native apps and websites by simply creating files in the app directory, using familiar web APIs like 'link' and 'href'.

  • How does Expo Router utilize native primitives for navigation?

    -Expo Router uses native primitives like UI Navigation Controller on Apple devices to ensure that gestures and animations feel truly native.

Outlines

00:00

🚀 Introduction to React Native and Expor Router

Evan Bacon introduces the evolution of React Native, a framework initially announced nearly a decade ago with a simple premise to leverage the web's strengths for building client-side applications. Today, it powers numerous trending apps in the App Store. Bacon, an engineer and creator of Expor Router, discusses the first file-based framework enabling the creation of apps for both web and native platforms with robust navigation. Expor Router uses familiar web APIs and native primitives for a seamless native feel, enhanced by the React compiler's integration for a more declarative and less code-intensive approach. The talk also hints at the upcoming integration with the next version of XL CI.

05:05

🌐 Harnessing Server-Driven UI with Expor Router

The speaker delves into the attributes of building native applications, focusing on the limitations of client-side applications and the benefits of involving server capabilities for data fetching and server rendering. Popular apps like Lyft, Netflix, and Reddit utilize server-driven UI for A/B testing and rendering varied UIs based on user criteria. However, setting up such systems is complex and often inaccessible to indie developers. Expo router aims to democratize server-driven UI by incorporating React Server Components (RSC) for cutting-edge server rendering across platforms, requiring extensive reworking of libraries within the Universal ecosystem.

10:09

🎨 Demonstrating AI-Powered Apps with Expor Router

Evan Bacon showcases a demo of an AI-powered chat application, similar to Chat GPT, which utilizes React Server Actions for server-rendered text streaming. The demo illustrates the creation of a server action, the use of suspense for maintaining connection until promise resolution, and the recursive rendering of text. The multiplatform capabilities of Expor Router's server environment are highlighted, as it adapts the UI components based on the device platform. The demo expands to include more complex interactions, such as integrating with native APIs for calendar permissions and event creation, demonstrating the seamless integration of server-rendered and client-interactive elements.

15:10

🔄 Live Demo of Expor Router's Cross-Platform Capabilities

The presenter conducts a live demonstration of the app, showcasing its development server and client interaction on a mobile device. The demo includes features like listing new movies, server actions for data recursion, and interactive elements like menus and touchables. It also highlights the app's ability to integrate with various services like Spotify, Google Maps, and Uber, emphasizing the background data loading and the use of RSC for optimizing network requests. The live demo concludes with real-time currency conversion and location-based to-do list generation, demonstrating the app's dynamic capabilities.

20:11

📈 Introducing Expo Atlas for Bundle Optimization

Evan Bacon introduces Expo Atlas, a new tool for visualizing and understanding the output of Expo bundles. It provides an overview of compiled modules, allowing developers to identify and address large dependencies. Expo Atlas offers a unique feature of showing both import and output source code for any module within the project, enabling developers to trace dependencies and optimize their projects effectively. The tool has been instrumental in the development of universal React server components and has improved the performance of the Metro resolver. Expo Atlas is presented as a valuable asset for developers to iterate faster and build better user experiences.

Mindmap

Keywords

💡React Native

React Native is an open-source framework for building native apps using React, a popular JavaScript library. It allows developers to build mobile apps for Android, iOS, and other platforms with a single codebase. In the video, React Native is highlighted as a significant framework that has grown to power numerous apps, indicating its impact on the industry.

💡Expo Router

Expo Router is introduced as the first file-based framework for building apps that work on both web and native platforms simultaneously. It uses familiar web APIs for navigation, allowing for the creation of robust navigation systems with simple file creation in the app directory. The concept is central to the video's theme of enhancing app development across platforms.

💡Native Primitives

Native Primitives refer to the basic building blocks used in app development that are native to a particular platform. In the context of the video, native primitives like UI navigation controllers are utilized to ensure that gestures and animations feel truly native, providing a seamless user experience across different devices.

💡React Server Components (RSC)

React Server Components are a cutting-edge approach to server rendering, allowing for the rendering of components on the server and streaming them to the client. The video discusses the integration of RSC with Expo Router, emphasizing the potential for improved performance and a more efficient development process.

💡Server-Driven UI

Server-Driven UI is a concept where the user interface is generated and controlled by server-side processes. The video mentions that popular native apps use server-driven UI for features like A/B testing and rendering different UIs based on various criteria. Expo Router aims to make this complex system more accessible to developers.

💡File-Based Framework

A file-based framework, as discussed in the video, allows developers to create and organize routes through file structures rather than traditional code-based setups. Expo Router exemplifies this concept, streamlining the process of building navigation for both native apps and websites.

💡Suspense

In React, Suspense is used to handle the loading state of asynchronous data fetching, keeping a component in a 'suspended' state until the data is ready. The video demonstrates how Suspense is used in conjunction with server actions to create smooth, incremental rendering experiences in apps.

💡Concurrent Mode

Concurrent Mode in React is a feature that enables more granular update scheduling and interleaved rendering of multiple components. The video touches on this concept in the context of RSC, showing how it can improve the performance of server-rendered apps.

💡Universal Code

Universal Code refers to code that can run on both the server and the client, taking advantage of server capabilities for rendering and data fetching while still providing a native-like experience on the client side. The video showcases how Expo Router and RSC enable the creation of universal apps.

💡Expo Atlas

Expo Atlas is a new tool introduced in the video for visualizing and understanding the bundle output of Expo projects. It helps developers identify and optimize large modules within their apps, contributing to better performance and a more efficient development process.

Highlights

React Native has grown to become a highly impactful framework for building client-side applications.

React Native powers hundreds of apps in the App Store trending list daily, with no signs of slowing down.

Expo Router is introduced as the first file-based framework for building apps that work on both web and native platforms.

Expo Router uses familiar web APIs for navigation and is also a nested router, enabling organization of routes into shared folders.

Expo Router employs native primitives for truly native gestures and animations on Apple devices.

Access to the React compiler from day one thanks to collaboration with the Meta team, reducing the need for useMemo or useCallback.

Expo Router brings React Server Components to all platforms, enabling server-driven UI through Expor Router.

Server-driven UI is an important system for building apps but has been inaccessible to indie developers.

Expo aims to make the most powerful version of server-driven UI available to everyone.

A live demo showcases building AI apps with React Server Components and Expo Router, including a chat GPT-like app.

Expo Router's server environment is multiplatform, aware of the device it's rendering for, such as iOS or Android.

Expo Router can server-render complex native UIs, such as a movies app with push animations and native menus.

RSC and Expo Router make it easy to build interactive elements that run on the client after server-rendering.

Expo SDK 51 and React 19 in new architecture enable universal server components in Expo Router.

An early beta of the server renderer part of Expo Router is expected by the end of the year or 2025.

Expo Atlas is introduced as a tool for visualizing and understanding Expo bundle output, aiding in optimization.

Expo Atlas provides real-time updates and the ability to trace dependencies, improving development speed and用户体验.

Expo Atlas has been crucial in building universal React server components and improving the Metro resolver.

Transcripts

play00:00

when react native was first announced

play00:02

nearly 10 years ago it had a very simple

play00:04

premise and that was web the good parts

play00:06

and from this basic concept react native

play00:08

has grown to become the most impactful

play00:10

framework for building client side

play00:12

applications today if we fast forward to

play00:15

now react native Powers hundreds of apps

play00:18

in the App Store trending list every

play00:20

single day and there's no signs of

play00:22

slowing down so where do we go from

play00:26

here I'm Evan bacon an engineer and the

play00:29

creator of exp router expor Router is

play00:32

the first file-based framework for

play00:33

building uh apps that work on both web

play00:36

and Native at the same

play00:38

time by simply creating files in the app

play00:41

directory uh you can instantly create

play00:43

robust navigation for both your native

play00:45

app and

play00:47

website it uses familiar web apis like a

play00:51

link and href to push between

play00:53

screens and it's also a nested router

play00:56

enabling you to organize routes into

play00:58

shared folders to create elements like

play01:00

tab bars headers drawers which work

play01:03

across you know children

play01:05

routs and of course the best part has to

play01:07

be that it uses native Primitives like a

play01:10

UI navigation controller on Apple

play01:11

devices so your you know gestures and

play01:14

your animations are all feeling truly

play01:16

native because they are truly native

play01:18

there's no way to tell that it's not

play01:19

native because it is

play01:20

native and starting uh you know day one

play01:24

we have access to the react compiler

play01:26

thanks to collaborating with the meta

play01:28

team this means that you no longer need

play01:30

to write use memo or use callback in

play01:32

your applications which is pretty sweet

play01:34

so a lot less code things are just truly

play01:37

declarative uh leading to a much better

play01:39

experience for both web like users and

play01:41

developers alike we'll be installing

play01:44

this in Expo CLI uh in the next version

play01:47

of uh XL CI when it comes out uh so

play01:50

pretty sweet if you haven't seen rat

play01:51

compiler yet I highly recommend checking

play01:52

it

play01:53

out but anyways there are

play01:56

many attributes to building native

play01:58

applications and and Expo provides

play02:01

solutions to most of them but all these

play02:03

Solutions are primarily targeted at uh

play02:06

client side applications and there's

play02:08

only so much that you can do with the

play02:09

client on its

play02:11

own things get really interesting when

play02:14

you start to involve the server when you

play02:15

bring in data fetching and server

play02:17

rendering from a data perspective most

play02:19

native apps operate essentially like

play02:21

single page websites uh this means

play02:23

there's slower performance and

play02:26

substantially less networking right

play02:27

everything is happening on the client

play02:30

nothing else is happening on the

play02:32

server now popular native apps such as

play02:34

Lyft Netflix Reddit you know so on and

play02:37

so forth all use some form of server

play02:39

driven UI in their production

play02:41

applications

play02:42

today uh and it's very complicated it's

play02:46

super hard to set up to configure to

play02:48

design and as a result it's Out Of Reach

play02:50

for most developers and most types of

play02:53

applications now they do this so that

play02:55

they can ab test and render different

play02:57

uis with a high degree of variation

play03:00

uh this is based on all sorts of things

play03:02

like criteria such as a user type

play03:04

location the currency uh they want to

play03:06

render different UI based on you know

play03:08

different criteria of the

play03:10

user and the approaches all vary in many

play03:12

small ways but they do share some common

play03:15

architecture such as using Json as

play03:18

semantic UI representation think of this

play03:20

like HTML but for custom native

play03:24

apps now we can see a pattern here

play03:26

server driven UI is an important system

play03:28

for building apps and it's just very

play03:31

inaccessible to Indie

play03:34

developers

play03:35

so what if we could make server driven

play03:38

UI available to everyone but also the

play03:41

most powerful version of it uh like ever

play03:44

imagined that's the goal of Expo

play03:47

router to do this we're bringing react

play03:50

server components the most Cutting Edge

play03:53

approach to server rendering to all

play03:55

platforms through expor router this is a

play03:57

huge undertaking as it will require re

play03:59

working many different libraries

play04:01

throughout the entire Universal

play04:02

ecosystem everything needs you know a

play04:04

couple refinements ranging to a ton of

play04:07

refinements uh but our official

play04:09

implementation of RSC for Universal apps

play04:12

is currently in early development

play04:14

however it is worth sharing the progress

play04:16

that we made so far at Expo because it's

play04:19

frankly pretty exciting to see what

play04:21

server driven apps are capable

play04:24

of now there's a lot to RSC such as

play04:29

server actions and concurrent routing

play04:31

and flights Etc but I figure it'd be

play04:33

easier to just show you guys what's

play04:35

possible in the form of a demo that we

play04:37

built at Expo now I've been really

play04:39

interested in AI lately you know just

play04:41

like everyone else on the internet uh

play04:43

but it's historically been pretty hard

play04:45

to build high-powered AI native apps and

play04:48

this is because streaming and server

play04:50

rendering are both critical aspects of

play04:52

working within llm but with react server

play04:54

components and expor router it's

play04:56

actually really really easy to build AI

play04:59

apps as I'll show you

play05:04

here so here I have a chat GPT like app

play05:08

which pings open AI via a react server

play05:10

action and streams in Native text from

play05:13

the server everything that returns back

play05:15

is at least partially server

play05:20

rendered so we can ask it a question

play05:22

like should native apps be Ser rendered

play05:24

which is a great question to ask it and

play05:26

of course it'll return something back

play05:27

like native apps are typically not

play05:29

server rendered apps or you develop

play05:30

using whatever things and this is

play05:32

because you know this is not something

play05:34

that people have traditionally done a

play05:35

lot or when they do they don't talk

play05:37

about it too

play05:38

frequently Now to create the server

play05:41

action we have another file which

play05:43

defines use server inside of a function

play05:45

this send message function over here uh

play05:49

and when we call send message which is

play05:51

fully typed it essentially is doing what

play05:54

an API route does it's making a network

play05:56

request to this code which runs on the

play05:58

server and then then we wrap it in

play06:00

suspense the suspense basically tells

play06:02

the connection to stay open until the

play06:05

promise resolves which means you can

play06:07

have a synchronous components inside of

play06:08

it and then down here we have an

play06:10

asynchronous function recursive text

play06:12

async react components pretty sweet and

play06:15

then we can incrementally uh recursively

play06:17

render through the text to render out

play06:20

all of our

play06:21

elements um and that's how we can create

play06:24

this effect right here now one novel

play06:26

aspect of exper router's server

play06:28

environment is that it's a multiplatform

play06:30

server now what this means is that when

play06:32

we call send message from an iOS device

play06:35

even though it's running on the server

play06:36

it knows to render the iOS version of

play06:38

react native text as opposed to the web

play06:40

version or Android versions so you

play06:42

essentially have like kind of a

play06:44

dimension of platforms a matrix a lot of

play06:47

complexity but it actually feels pretty

play06:51

sweet and this is just the basics we can

play06:53

scale this concept up to any native UI

play06:56

so let's do something a little bit more

play06:58

exciting

play07:01

when react native was first demoed they

play07:03

showed a truly native movies app and you

play07:05

had like push animations you could

play07:06

scroll through it it was so neat uh so I

play07:08

thought it could be fun to pull movies

play07:10

into this prototype

play07:12

somehow for inspiration I looked at what

play07:14

the state-of-the-art best possible AI

play07:17

apps had to offer in chat gp4 when you

play07:19

ask for movies it renders a bulleted

play07:21

list of markdown some text here after it

play07:24

searches Bing you know cool I also tried

play07:26

this with 40 and it's just a little bit

play07:28

faster and on Google Gemini it does the

play07:31

same thing but with images and links

play07:34

what we're seeing here is that this is

play07:35

just markdown with Expo we can do a lot

play07:39

better here we can match any query to

play07:42

search for movies send it up server

play07:45

render views stream them back down with

play07:48

Native UI menus links elements where we

play07:50

can then server actions to recurse back

play07:53

into it find more actors and then

play07:55

request another server rendered element

play07:58

uh pulling everything down from the

play07:59

client all these movie cards are

play08:01

rendered on the server we can even

play08:02

interact with Native apis by doing like

play08:04

create an event this will server render

play08:06

a calendar card which then can access

play08:08

the calendar permissions and then uh

play08:10

create an

play08:11

event so pretty sweet

play08:17

[Applause]

play08:26

oh overall way better user experience

play08:28

with a lot less reading but even more

play08:30

exciting than this cuttingedge developer

play08:32

experience or user experience is a

play08:35

developer experience cuz it only it is

play08:37

the same format as what we did with the

play08:38

text we're just using views and images

play08:41

because we have RSC this this semantic

play08:44

representation of our views uh so here

play08:47

we have a suspense boundary to show a

play08:49

skeleton loader while an ASN component

play08:51

fetches data and then renders the movies

play08:53

and streams them down it just makes

play08:56

sense to look at it feels great it's

play08:58

awesome

play09:00

and then to add the interactive elements

play09:02

because you can't have interactions on

play09:04

the server those need to run on the

play09:05

client we can Mark a wrapper component

play09:07

with used client which means that just

play09:09

this one boundary gets split out and

play09:11

executed on the client that code is

play09:13

bundle split out and loaded over the air

play09:16

when you uh when you want to interact

play09:18

with this component when it mounts this

play09:20

is what enables um all these different

play09:22

interactions where you have things like

play09:24

menus and touchables and so on and so

play09:26

forth so it's really easy to step

play09:27

between the two boundaries between

play09:29

client and server using this

play09:33

directive because after we jump through

play09:36

all of the Hoops required for Server

play09:38

rendering and trust me there's there's

play09:39

lots of Hoops we aren't just rendering

play09:41

to the Dom like we get to render to

play09:44

truly native views as if the app were

play09:46

built with first-party tools like xcode

play09:48

and Android studio um because you will

play09:50

be using xcode Android studio as well

play09:52

it's kind of like how you do today um so

play09:54

it's progressively rendered best

play09:55

practices is truly Limitless you get you

play09:58

know native scrolling just

play09:59

there there are no limits on this you

play10:01

get the best of web and all the power of

play10:04

native but the best part by far has got

play10:08

to be that it renders like this on every

play10:11

single platform we write this once and

play10:14

it runs everywhere mostly because I'm

play10:15

using a lot of Base Primitives like view

play10:17

image and text and loading animation and

play10:19

like animations so these especially work

play10:21

well across platforms but because we're

play10:24

also we're pulling a lot of our our

play10:26

logic out and moving it to the server so

play10:28

anything related to network requests are

play10:30

trly Universal because the server is you

play10:32

know it's agnostic to what the

play10:33

platform's

play10:37

doing now this is the part where I will

play10:40

attempt to live demo the app that I just

play10:42

showed you um the Wi-Fi is spectacular

play10:45

in here uh so uh we'll just go ahead and

play10:48

give this a

play10:49

shot all right yeah you can see see my

play10:52

computer here great let's connect to the

play10:55

uh the Hotpot

play10:59

oh

play11:01

man all right and then right here I have

play11:04

Expos CI running so you see whatever um

play11:08

and what I want to do is I basically

play11:10

want to show you guys the dev server

play11:12

running with my phone here this is this

play11:14

is my phone um and so you can see uh the

play11:18

client and the server as it's recursing

play11:20

back and forth between the two so here

play11:22

this is a development app an expo app we

play11:24

will connect it and we'll see how it

play11:26

goes so opening it up here in the

play11:28

background you can see see we're loading

play11:30

in all the flight chunks all the

play11:31

asynchronous bundles and we have our app

play11:34

so just like in the demo we can list

play11:35

some new movies press that button

play11:38

recurses back to the server comes

play11:40

forward starts rendering the suspense

play11:43

and we can see data fetching in the

play11:44

background I mean so you know the big

play11:46

chunk is when the data loaded in right

play11:49

um over here just like before you know

play11:51

we can like long press the select and

play11:53

here you see that there is actually a

play11:54

server action which is then recursing

play11:56

for more data and then fetching so I'd

play12:00

like to say that we have like timers to

play12:01

emulate the production environment and

play12:03

how that latency will work but the Wi-Fi

play12:06

is just doing that

play12:07

automatically so let's find you you go

play12:10

Challengers create an event just like in

play12:11

the

play12:15

thing there we go we can render out the

play12:17

views but we can also do other things

play12:20

like this is so easy I I demoed part of

play12:22

this last week and uh in the the last

play12:25

few days I just took all of the input

play12:27

that people have given about what we

play12:28

should add to the Prototype and I just

play12:30

built it in because it's so easy to use

play12:32

and I was really struggling to

play12:33

demonstrate that in the talk uh so I I

play12:36

just wrote a bunch more parts so here we

play12:37

can say um show me some

play12:42

classic Polish

play12:45

music and now what this is going to do

play12:48

is Ping the dev server and then render

play12:50

down a Spotify card and we can log into

play12:52

Spotify this uses Expo off session log

play12:55

in right

play12:57

there log oh man

play12:59

man everyone look away for just a

play13:04

moment it's perfect uh logs in oh man

play13:08

it's so slow you get to see all the

play13:09

states here we got all of our Polish

play13:11

music then streaming in um we're able to

play13:14

just encapsulate all of this logic

play13:16

everything required for Spotify

play13:17

authentication in a single component

play13:19

including the secret handshake that is

play13:21

required to get a Long Live token um

play13:24

never been before been anything quite

play13:25

like it uh but we can do a lot more than

play13:27

that too so let's look for um

play13:30

let's say uh show me things to do in

play13:37

crao so now it's going to Ping the dev

play13:39

server back here

play13:42

again any moment now and then it will

play13:45

ping Google Maps so we see it loading

play13:47

here we can see the animation as it's

play13:49

coming through pinging Google Maps

play13:51

there's all the Google Maps data in the

play13:52

background and now we can slide through

play13:55

a native map component so even though

play13:57

this content was server rendered it was

play13:59

able to stream down to the client where

play14:01

we can render a native map on top of it

play14:03

and then also look at just how how much

play14:05

data is loaded in the background here so

play14:07

RSC is automatically optimizing our

play14:09

requests by converting it into the

play14:10

minimal amount of RSC uh code required

play14:13

to stream down um so I think if we

play14:17

weren't doing that the network request

play14:19

would be a lot slower so we can come in

play14:21

here and we can uh let's see we got this

play14:24

Cathedral um we can select it and then

play14:27

we can get the weather in this area

play14:29

ping it back render us down a weather

play14:32

card that's pretty sweet we can also

play14:34

book an Uber over here um oh I do have

play14:37

the weather set to Fahrenheit we could

play14:38

switch that over to Celsius I know how

play14:40

you guys like that over here and uh

play14:42

we're still booking the Uber we have the

play14:44

Uber here we could request the Uber

play14:47

opens up the Uber app just like that and

play14:49

I've got an Uber to the location what is

play14:51

that pln1 18 I don't I don't know what

play14:53

that means so we can ask the uh let's

play14:56

see

play14:57

um convert

play15:00

whoa convert 18 pln to

play15:06

USD and then it will probably stream

play15:08

back and answer telling me how to

play15:10

convert it you know $4.50 that's nice

play15:13

but what about all these other numbers

play15:14

in here like 22 and such

play15:17

um well here's where things get really

play15:19

interesting so I don't have a card to

play15:21

just dynamically convert pln to USD I

play15:25

didn't create that card but the number

play15:27

one piece of feedback I got was that uh

play15:29

you know since all this is running on

play15:30

the server why don't we just have the AI

play15:32

write the elements just write the code

play15:35

and then render it and stream it down so

play15:38

I'm going to go ahead and try that live

play15:39

for the first time here and we'll see

play15:40

how it works um create a

play15:45

um

play15:47

currency

play15:48

converter

play15:51

component and now what's going to happen

play15:53

here is this is going to Ping open Ai

play15:55

and it is going to generate the

play15:57

component for us so there is no

play15:59

guarantee that the component will work

play16:01

and it it you know it's a nice venue to

play16:04

have code just error out on stage but

play16:06

there it is look at

play16:09

that it's pretty

play16:16

sweet we haven't tried it yet we don't

play16:18

know if it works so what are some of

play16:20

these numbers I mean they don't have to

play16:21

be exactly but 22 okay 22 pln convert to

play16:24

USD $5.50 so we do have it working

play16:33

and right up here we can see the actual

play16:36

code that it generated this is react

play16:38

Nate it's universal code it it wrote all

play16:40

of this code for us this code doesn't

play16:41

exist in there um we can scale this out

play16:45

in any direction we want to take it so

play16:46

we could also say um show me the

play16:50

locations as a to-do list you know cuz I

play16:54

wrote this locations map thing with like

play16:56

Vegas in mind and it doesn't work in

play16:59

like we just have flat buildings so a

play17:01

different form factor is better so here

play17:02

now we have a to-do list so we it's

play17:05

fully interactive like we have uh okay

play17:07

we have checkboxes I I said it was fully

play17:09

interactive then I remembered it might

play17:11

not be um yeah here we've got Expo

play17:13

checkbox we inform it of which uh

play17:16

libraries in the SDK it can use before

play17:19

it generates the code out for us um so

play17:22

yeah just like that and then we've got

play17:23

uh all of the locations from

play17:25

before so that is the iOS part of the

play17:29

we can just switch back over I mean like

play17:31

we got the dev

play17:40

server it's pretty good we have the dev

play17:42

server running right here this is expo

play17:44

Expo CI we just hit the W key and launch

play17:46

it right into the web so you know same

play17:48

deal as before we could say list some

play17:50

new movies and it'll launch the movies

play17:52

the craziest part is that I I I didn't

play17:54

have time to really thoroughly test that

play17:56

UI generation in the cloud thing so I

play18:00

have not tested that on all platforms

play18:01

yet but we can just try it here one idea

play18:03

I had was what if we create a chat

play18:08

UI

play18:10

component and see how this does we'll

play18:12

take a second I mean I didn't have

play18:15

enough time to add the loading indicator

play18:16

you know like the skeleton or maybe you

play18:18

watch the code stream in because it

play18:19

streams in all the code first and then

play18:21

we evaluate it so then it would look you

play18:23

know a bit bit snappier cuz we are

play18:25

getting instant response but looks like

play18:27

it it is making some progress there in

play18:29

the background what is his progress oh

play18:32

oh okay so we've got a little chat UI

play18:34

here we could say um hello appjs comp

play18:38

that's pretty sweet I can't believe that

play18:41

it's crazy that this is working um I

play18:44

mean it's not I planed this obviously

play18:46

this all works like um and of course use

play18:50

Expo so I mean why does it how does it

play18:53

even know to use my photo there like it

play18:55

generated this code here in the

play18:57

background like it

play18:59

it's okay so it has like my GitHub

play19:01

profile in there I guess it like knows

play19:03

maybe I've like informed it but then

play19:05

yeah here's all the code it's generating

play19:06

back here

play19:08

incredible all right let's switch back

play19:10

over the keynote real

play19:12

quick so that is what it looks like when

play19:14

we take the modern state of server

play19:16

rendering and Ai and then bring them

play19:18

universally to every platform with Expo

play19:21

router we are seamlessly gliding between

play19:23

client and server in a fully typed

play19:25

file-based framework for the first time

play19:27

ever you only have to configure complex

play19:29

apis for one platform and that's the

play19:32

server we waterfalls and parallel

play19:34

requests are all taken for you care of

play19:37

for you automatically uh because this

play19:39

isn't just some Rinky Dink server

play19:40

rendering system we have in here this is

play19:42

react server components this is the best

play19:43

that the web has to offer running

play19:45

universally on all platforms secrets are

play19:47

secured automatically static client code

play19:50

is automatically it's a remove from the

play19:51

bundle uh we we can SSG code in fact

play19:54

this code has the RSC requests uh

play19:57

pre-built at build time and embedd it in

play20:00

the bundle meaning if we start this app

play20:02

in airplane mode I probably should have

play20:03

did that when my phone was linked then

play20:05

it just fires up instantly uh the only

play20:07

time that you would actually hit a

play20:08

network request or interact with a

play20:10

server is when you're going to interact

play20:11

with the server anyways to make a fetch

play20:13

request so it still feels truly native

play20:15

very Snappy at a component level tons

play20:18

and tons of new benefits too many to go

play20:21

into just redefining what's possible

play20:23

with our mobile devices and enabling new

play20:25

types of apps to be built in record time

play20:29

now the app you just saw is running Expo

play20:32

SDK 51 react 19 in new architecture

play20:34

we're still actively developing the

play20:36

server renderer part that adds used

play20:38

client and used server and then the the

play20:39

part that actually deploys the server uh

play20:42

so if we move fast we can have an early

play20:43

beta out maybe by the end of this year

play20:45

but just to be safe we'll say 2025 so

play20:47

consider this in RFC is server rendering

play20:50

something that you want to see on Native

play20:52

I believe so I love using the system um

play20:55

I can't believe I was able to like get

play20:56

all that stuff working the last few days

play20:58

so the future is very bright I'm Evan

play21:01

bacon and this has been universal server

play21:03

components in Expo

play21:16

router but but but that that's there is

play21:19

one more thing that we'd like to

play21:21

announce today in the Expo team so to do

play21:23

that please join me in welcoming Cedric

play21:25

Vantin to the stage

play21:27

[Applause]

play21:41

Expo router has been our most ambitious

play21:44

project yet and it was clear for us from

play21:47

the start that traditional tools weren't

play21:49

going to help us build it out so we

play21:52

build new ones introducing today Expo

play21:57

Atlas

play21:58

Expo Atlas is a tool to visualizing and

play22:02

understanding your Expo bundle output

play22:05

right from the start it gives you an a

play22:08

complete overview of all compiled

play22:10

modules within your app with this you

play22:13

can easily spot like really big ones or

play22:16

relatively large ones like this one low

play22:20

Dash so where can we go from here how

play22:24

can we how can we see where it's

play22:26

imported and how can we resolve it

play22:29

so to do that we can just click it for

play22:32

the first time ever in react native you

play22:35

now have both the import and output

play22:37

source code for any modules within your

play22:39

whole project and it doesn't just end

play22:43

there with this you can easily Trace

play22:46

down where certain dependencies are

play22:48

imported or how it's being imported and

play22:50

especially why it's being

play22:53

imported now let's get rid of that lad

play22:56

Das real quick

play23:00

so there we

play23:01

go unlike traditional Source map

play23:04

explorers Expo Atlas updates right away

play23:07

so you can try different optimization

play23:09

approaches without having any

play23:11

distractions at

play23:20

all going back to our bundle overview we

play23:25

can easily spot that we just shaved 600

play23:27

kiloby from bundle just by verifying

play23:30

where certain dependencies are being

play23:33

imported now Expo Atlas has helped us

play23:37

tremendously internally at Expo we

play23:40

believe that this tool has been

play23:41

fundamentally crucial crucial for all of

play23:43

our uh projects it helped us build out

play23:46

universal react server components it

play23:49

even helped us out create the new Metro

play23:51

resolver which is up to six times faster

play23:53

and it also required us to add support

play23:55

for nanc for meting to Expo

play24:00

it won't it won't have help your app

play24:02

have smooth animations though but it

play24:04

does help you iterate faster at

play24:07

scale which in turns enables you to move

play24:11

faster and build better user

play24:15

experience so try it out today you can

play24:18

try it out in any SDK 51 project using

play24:21

this feature flag you can also wait for

play24:25

the release blog post which should be up

play24:27

later today or tomorrow on expo. death.

play24:29

blog and we can't wait to see how you

play24:32

will use

play24:34

Atlas thanks

play24:37

[Applause]

play24:39

[Music]

play24:39

[Applause]

Rate This

5.0 / 5 (0 votes)

Related Tags
React NativeExpo RouterServer RenderingAI IntegrationCross-PlatformMobile DevelopmentUI ComponentsWeb APIsNative PrimitivesExpo SDK