The New Architecture Is Here… What Now?

Rate this content
Bookmark
Slides

The React Native new architecture has been "coming next year!" since 2019 - but, this time, it’s actually here! So… what now? What do we actually need to do, to benefit from this all new shiny tech? In this talk, I want to provide some insights and in-depth analysis of the current state of the migration path to the new architecture, to help you and your team evaluate and estimate when and how and how long it will take you to get to the next level!

This talk has been presented at React Advanced 2022, check out the latest edition of this React Conference.

FAQ

The main change in the new architecture is the removal of the bridge, which eliminates the need for communicating through JSONs and reduces bottlenecks. This change enhances native interoperability and concurrency, improving overall app performance and memory management.

The new architecture offers several benefits including faster startup times, better memory management, improved code quality due to structured and safe coding practices, and a better developer experience through new tooling.

The migration process begins by referring to the 'Migrating to the New Architecture' documentation available on the React Native website. This guide provides detailed steps for migrating libraries and applications to the new architecture.

Common challenges include ensuring proper typing, especially when using TypeScript or Flow, adapting to new configurations required by the architecture, and updating third-party libraries to be compatible with the new system.

React 18 introduces features like automatic batching, which can affect how updates are processed. When using the new React Native architecture, it's necessary to ensure that your state management libraries and other dependencies are compatible with React 18.

As of the latest updates, only a small number of third-party libraries have been fully migrated to the new architecture. Efforts are ongoing within the React Native community to increase this number and provide support for more libraries.

New contributors should start with small projects to build confidence and understanding. Establishing direct communication with maintainers and focusing on making any positive contribution, regardless of size, is recommended.

Contributors should establish healthy boundaries, such as not feeling pressured to respond to every issue immediately. It's important to manage time and commitments to prevent burnout and maintain enthusiasm for the project.

Lorenzo Sciandra
Lorenzo Sciandra
22 min
21 Oct, 2022

Comments

Sign in or register to post your comment.
Video Summary and Transcription
The Talk discusses the new architecture in React Native, highlighting its benefits such as native interoperability, concurrency, faster startup, better memory management, and improved code quality. The migration process to the new architecture involves refactoring, codegen, and extending native interfaces. Challenges include typing, configuration, and migrating third-party libraries. React 18 introduces automatic batching and compatibility with the new architecture. Microsoft is expanding React Native to target desktop platforms and has a dedicated open-source tooling repository. The Talk emphasizes the importance of open-source contribution and setting healthy boundaries.

1. Introduction to the New Architecture

Short description:

I'm here to talk about the new architecture and what it means to start using it. The main difference is the disappearance of the bridge, enabling native interoperability and concurrency. This leads to faster startup, better memory management, and improved code quality. The new architecture also provides a better developer experience. Let's start with the documentation.

All right. Thank you, Kathleen. I like the metaphor with Gandalf for two reasons. One of them is that in a very famous point of the Lord of the Rings, it kind of like just almost dies and just before doing that, it's like, run, you fools. So, I feel I'm in that phase. I don't know if I'm going to show up next year with like super white hair and white robe, but, you know, we can make things happen. We'll see about that.

Anyway, I'm here to talk about the new architecture, like we've had Gand, we've had Nicola talking about it. So I'm kind of here answering the, you know, the next logical question, which is like, okay, so we have the new architecture, what now? So Kathleen already did a great job introducing me. I just wanted to reiterate I'm a senior software engineer at Microsoft and I've been a React native core maintainer and a releaser since 2018. So, yeah, I've been around for a while.

And because we had Nicola and Gand doing a really great job kind of like going through the concepts of the new architecture, I'm just going to kind of cheat my way through my first few slides by saying, oh yeah, let's just, you know, this is the old architecture. We all know what it looks like. Absolutely we all do know. And then, boom, here's the new architecture. Yeah, we don't need to know literally everything about it. It's fine. Just let's recap very, very quickly like the main differences. So, the main one is the bridge disappearing. And that means no more communicating through JSONs, no more bottleneck. This means native interoperability and concurrency, which is great and enables all this fancy reg data and stuff. Because we have a better structure, it means that also we have a faster start up because now the native components get only loaded when it's actually needed. We have better memory management because now the OS knows more about what's going on within this cross platform app. And then also we have, well, by, you know, having more structure and having ties safely to things like Codegen, we have also, you know, less clashes, better code quality in general. And technically, through the new tooling, we also have a better developer experience. And on paper, this is great. You know, we have Gantt, we have Nikolai pinning it up and, you know, I'm an engineer. So the first thing that comes to mind whenever I hear something saying something positive is, huh, okay, when do I press X on this conversation? So let's try to kind of do that. Let's see actually what does it mean to start using the new architecture. And the first starting point, the easiest place to start is actually the documentation.

2. Migrating to the New Architecture

Short description:

The documentation for migrating to the new architecture is well done. The process involves refactoring, adding codegen to the package, running a command, and extending the native interfaces. For apps, the migration process is slightly more complicated but offers more granularity. From version 71 onward, the steps become smaller and more achievable. However, there are complications to consider, such as typing and the requirements from CodeGen and modules for the type system.

So if you go on the Rackintive website, in the guide section, there's a beautiful page called Migrating to the New Architecture. And actually, I wanted to take a second and give a huge round of applause to Ricardo, Nikolai, and the rest of the team because, like, the documentation is pretty well done. And, you know, usually, it sits fairly low in like the list of priorities. But, like, spending time on having proper documentation is very, very good.

And also, just keep this in mind from here onward, for this first few slides, the premise is that we are on 67, so the first version, the last version before new architecture and we want to migrate to latest, so the version that Nikolai was using earlier, so 71. Why that? You'll see in a second.

So if we look at that documentation and we're like, okay, I have a library, I need to migrate it. What we end up having in terms of load of things that we have to do is pretty much this. So we have our library, we need to do a bit of refactoring, we add the codegen to the package, and then through that we run a command and we have the native interfaces and now we just need to extend them. So it should be fairly straightforward. For apps instead, things get slightly more complicated but in both good and bad ways. Like, oh yeah, yeah, the drawing is much more complicated, it has more colors and stuff, but at the same time, has a level of granularity which, you know, allows us to kind of like migrate one part first and the second part second. But actually, this is where the things that Nicola was mentioning earlier with 71, like things are going to change because now, from 71 onward, pretty much like that entire draft reduces to this, which is much smaller, the steps are much more achievable. I hope you can read it, by the way. It's slightly small, but like the purpose is like big graph, smaller graph. So, we're fine. Now, what go wrong? Okay. So, we have documentation. We have seen that more or less things are getting easier. We have the steps, you know. Fine, everything is going to be absolutely perfect. Well, I already told you, I don't trust anything positive in the world, so let's see actually some of the complications. Now, for foreshadowing purposes, I called these challengers. Why? We'll see in a second. But, basically, I've selected three which I think are fairly important. And the first one of them is typing. As I was mentioning earlier, the new architecture pretty much forces you to type your code. If you're using vanilla JavaScript, you apparently like a lot of pain but like please just use TypeScript or Flow. And once you start looking into the requirements from CodeGen and to modules for your type system, you realize that okay, on a surface level, like all the main types, they all work just fine. But then you start looking into the more advanced things and like, oh, hang on a second.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Scaling Up with Remix and Micro Frontends
Remix Conf Europe 2022Remix Conf Europe 2022
23 min
Scaling Up with Remix and Micro Frontends
Top Content
This talk discusses the usage of Microfrontends in Remix and introduces the Tiny Frontend library. Kazoo, a used car buying platform, follows a domain-driven design approach and encountered issues with granular slicing. Tiny Frontend aims to solve the slicing problem and promotes type safety and compatibility of shared dependencies. The speaker demonstrates how Tiny Frontend works with server-side rendering and how Remix can consume and update components without redeploying the app. The talk also explores the usage of micro frontends and the future support for Webpack Module Federation in Remix.
Understanding React’s Fiber Architecture
React Advanced 2022React Advanced 2022
29 min
Understanding React’s Fiber Architecture
Top Content
This Talk explores React's internal jargon, specifically fiber, which is an internal unit of work for rendering and committing. Fibers facilitate efficient updates to elements and play a crucial role in the reconciliation process. The work loop, complete work, and commit phase are essential steps in the rendering process. Understanding React's internals can help with optimizing code and pull request reviews. React 18 introduces the work loop sync and async functions for concurrent features and prioritization. Fiber brings benefits like async rendering and the ability to discard work-in-progress trees, improving user experience.
Full Stack Components
Remix Conf Europe 2022Remix Conf Europe 2022
37 min
Full Stack Components
Top Content
RemixConf EU discussed full stack components and their benefits, such as marrying the backend and UI in the same file. The talk demonstrated the implementation of a combo box with search functionality using Remix and the Downshift library. It also highlighted the ease of creating resource routes in Remix and the importance of code organization and maintainability in full stack components. The speaker expressed gratitude towards the audience and discussed the future of Remix, including its acquisition by Shopify and the potential for collaboration with Hydrogen.
Raising the Bar: Our Journey Making React Native a Preferred Choice
React Advanced 2023React Advanced 2023
29 min
Raising the Bar: Our Journey Making React Native a Preferred Choice
Watch video: Raising the Bar: Our Journey Making React Native a Preferred Choice
This Talk discusses Rack Native at Microsoft and the efforts to improve code integration, developer experience, and leadership goals. The goal is to extend Rack Native to any app, utilize web code, and increase developer velocity. Implementing web APIs for React Native is being explored, as well as collaboration with Meta. The ultimate aim is to make web code into universal code and enable developers to write code once and have it work on all platforms.
Opensource Documentation—Tales from React and React Native
React Finland 2021React Finland 2021
27 min
Opensource Documentation—Tales from React and React Native
Documentation is often your community's first point of contact with your project and their daily companion at work. So why is documentation the last thing that gets done, and how can we do it better? This talk shares how important documentation is for React and React Native and how you can invest in or contribute to making your favourite project's docs to build a thriving community
The Eternal Sunshine of the Zero Build Pipeline
React Finland 2021React Finland 2021
36 min
The Eternal Sunshine of the Zero Build Pipeline
For many years, we have migrated all our devtools to Node.js for the sake of simplicity: a common language (JS/TS), a large ecosystem (NPM), and a powerful engine. In the meantime, we moved a lot of computation tasks to the client-side thanks to PWA and JavaScript Hegemony.
So we made Webapps for years, developing with awesome reactive frameworks and bundling a lot of dependencies. We progressively moved from our simplicity to complex apps toolchains. We've become the new Java-like ecosystem. It sucks.
It's 2021, we've got a lot of new technologies to sustain our Users eXperience. It's time to have a break and rethink our tools rather than going faster and faster in the same direction. It's time to redesign the Developer eXperience. It's time for a bundle-free dev environment. It's time to embrace a new frontend building philosophy, still with our lovely JavaScript.
Introducing Snowpack, Vite, Astro, and other Bare Modules tools concepts!

Workshops on related topic

AI on Demand: Serverless AI
DevOps.js Conf 2024DevOps.js Conf 2024
163 min
AI on Demand: Serverless AI
Top Content
Featured WorkshopFree
Nathan Disidore
Nathan Disidore
In this workshop, we discuss the merits of serverless architecture and how it can be applied to the AI space. We'll explore options around building serverless RAG applications for a more lambda-esque approach to AI. Next, we'll get hands on and build a sample CRUD app that allows you to store information and query it using an LLM with Workers AI, Vectorize, D1, and Cloudflare Workers.
Introducing FlashList: Let's build a performant React Native list all together
React Advanced 2022React Advanced 2022
81 min
Introducing FlashList: Let's build a performant React Native list all together
Top Content
WorkshopFree
David Cortés Fulla
Marek Fořt
Talha Naqvi
3 authors
In this workshop you’ll learn why we created FlashList at Shopify and how you can use it in your code today. We will show you how to take a list that is not performant in FlatList and make it performant using FlashList with minimum effort. We will use tools like Flipper, our own benchmarking code, and teach you how the FlashList API can cover more complex use cases and still keep a top-notch performance.You will know:- Quick presentation about what FlashList, why we built, etc.- Migrating from FlatList to FlashList- Teaching how to write a performant list- Utilizing the tools provided by FlashList library (mainly the useBenchmark hook)- Using the Flipper plugins (flame graph, our lists profiler, UI & JS FPS profiler, etc.)- Optimizing performance of FlashList by using more advanced props like `getType`- 5-6 sample tasks where we’ll uncover and fix issues together- Q&A with Shopify team
Detox 101: How to write stable end-to-end tests for your React Native application
React Summit 2022React Summit 2022
117 min
Detox 101: How to write stable end-to-end tests for your React Native application
Top Content
WorkshopFree
Yevheniia Hlovatska
Yevheniia Hlovatska
Compared to unit testing, end-to-end testing aims to interact with your application just like a real user. And as we all know it can be pretty challenging. Especially when we talk about Mobile applications.
Tests rely on many conditions and are considered to be slow and flaky. On the other hand - end-to-end tests can give the greatest confidence that your app is working. And if done right - can become an amazing tool for boosting developer velocity.
Detox is a gray-box end-to-end testing framework for mobile apps. Developed by Wix to solve the problem of slowness and flakiness and used by React Native itself as its E2E testing tool.
Join me on this workshop to learn how to make your mobile end-to-end tests with Detox rock.
Prerequisites- iOS/Android: MacOS Catalina or newer- Android only: Linux- Install before the workshop
How to Build an Interactive “Wheel of Fortune” Animation with React Native
React Summit Remote Edition 2021React Summit Remote Edition 2021
60 min
How to Build an Interactive “Wheel of Fortune” Animation with React Native
Top Content
Workshop
Oli Bates
Oli Bates
- Intro - Cleo & our mission- What we want to build, how it fits into our product & purpose, run through designs- Getting started with environment set up & “hello world”- Intro to React Native Animation- Step 1: Spinning the wheel on a button press- Step 2: Dragging the wheel to give it velocity- Step 3: Adding friction to the wheel to slow it down- Step 4 (stretch): Adding haptics for an immersive feel
Deploying React Native Apps in the Cloud
React Summit 2023React Summit 2023
88 min
Deploying React Native Apps in the Cloud
WorkshopFree
Cecelia Martinez
Cecelia Martinez
Deploying React Native apps manually on a local machine can be complex. The differences between Android and iOS require developers to use specific tools and processes for each platform, including hardware requirements for iOS. Manual deployments also make it difficult to manage signing credentials, environment configurations, track releases, and to collaborate as a team.
Appflow is the cloud mobile DevOps platform built by Ionic. Using a service like Appflow to build React Native apps not only provides access to powerful computing resources, it can simplify the deployment process by providing a centralized environment for managing and distributing your app to multiple platforms. This can save time and resources, enable collaboration, as well as improve the overall reliability and scalability of an app.
In this workshop, you’ll deploy a React Native application for delivery to Android and iOS test devices using Appflow. You’ll also learn the steps for publishing to Google Play and Apple App Stores. No previous experience with deploying native applications is required, and you’ll come away with a deeper understanding of the mobile deployment process and best practices for how to use a cloud mobile DevOps platform to ship quickly at scale.
Effective Detox Testing
React Advanced 2023React Advanced 2023
159 min
Effective Detox Testing
Workshop
Josh Justice
Josh Justice
So you’ve gotten Detox set up to test your React Native application. Good work! But you aren’t done yet: there are still a lot of questions you need to answer. How many tests do you write? When and where do you run them? How do you ensure there is test data available? What do you do about parts of your app that use mobile APIs that are difficult to automate? You could sink a lot of effort into these things—is the payoff worth it?
In this three-hour workshop we’ll address these questions by discussing how to integrate Detox into your development workflow. You’ll walk away with the skills and information you need to make Detox testing a natural and productive part of day-to-day development.
Table of contents:
- Deciding what to test with Detox vs React Native Testing Library vs manual testing- Setting up a fake API layer for testing- Getting Detox running on CI on GitHub Actions for free- Deciding how much of your app to test with Detox: a sliding scale- Fitting Detox into you local development workflow
Prerequisites
- Familiarity with building applications with React Native- Basic experience with Detox- Machine setup: a working React Native CLI development environment including either Xcode or Android Studio