#react

Subscribe
We're bringing free articles, videos, courses, and tutorials to help you learn all about ReactJS, whether you're a beginner or a pro. Introduced in 2011, the framework has become essential for web and mobile developers alike, enabling modern apps by look and function. And while other JS tools have expanded or revised its original notions, React's popularity is still the one to beat.
Explore what's new in the 2024 editions of JSNation and React Summit!
Explore what's new in the 2024 editions of JSNation and React Summit!
Featured Article
JSNation and React Summit are the key JavaScript and React conferences of the year, expecting over 3K attendees, featuring 110+ speakers, and offering 15+ Free and PRO workshops altogether. All this excitement will be in Amsterdam and online in June! As always, you can expect deep and interactive talks, Q&A sessions, a food truck festival, activities to explore Amsterdam, and a ferry ride to the venue. And what's fresh this year?More Connections:
Making connections is the main focus of JSNation and React Summit  in 2024! Arriving solo? Fear not! During the conference days, you'll have plenty of opportunities to network and get to know others. If you're with friends, that's also awesome – you'll have many things to enjoy together!• Remember the Treasure Hunt? Or those puzzle-collecting competitions with fellow attendees? If you've been to one of GitNation conferences in-person, you definitely should. It's all about scouring the venue for treasure and getting prizes. This year, we've crafted something simpler to participate in, yet as much fun!• There are more gaming areas where you can relax during the breaks.• Compete in arcade machines to see who is better at football or kart racing.• Join in the buddy matchmaking activity to connect with like-minded attendees for engaging conversations.More Excitement:
Fun is something we all need, especially considering how focused we are during the workdays. So adding a bit more excitement to the conference can't be overlooked!• Start your day with a smartphone orchestra performance! The details are under wraps until you arrive – just be there on time.• We're not letting the biggest JavaScript and React party end too soon – come join us for an after-afterparty at a special place, where the fun keeps rolling! And guess what? The party doesn't stop there – you'll also receive a list of cool bars to explore and keep the networking alive until the morning!• What is more, this year we're inviting you to join the C3 Dev Festival party. Get ready to dive into performances from over 18 DJs, live coders, and famous artists!More Gastronomic Delights:
We understand that good food matters, so there will be something tasty for everyone!• Rest assured, we'll have healthy, vegan, and gluten-free options available.• Are you a burger lover? No worries, we've doubled up on last year's most popular food truck with burgers.• Hungry for more? We'll hook you up with a list of good restaurants to check out before or after the conference.More Ease and Relaxation:
We're working hard to ensure your conference experience goes smoothly! So you can focus on networking, learning, and having fun without any distractions!• Take part in uninterrupted discussion rooms located in quiet zones, speed through registration with faster lines at the pre-party and badge pick-up, and easily find your way around the conference with better signage.• Stay focused with soundproofing improvements and stay connected with discounted e-SIMs with data and charging stations at the working area.• Plus, enjoy breaks every 4 talks on remote days to stay refreshed and engaged.With an array of enhancements inspired by your valuable feedback, JSNation and React Summit 2024 promise an experience like never before. Have more ideas stirring in your mind? After each conference, we send out a link to gather feedback. If you could spare a moment to share your thoughts, we'd really appreciate it! Your input is valuable to us. We're committed to continually improving for you. Can’t wait to see you at the conference!
Future of Frontend Frameworks Fireside Chat
React Summit 2024React Summit 2024
28 min
Future of Frontend Frameworks Fireside Chat
Fred K. Schott
Minko Gechev
Ryan Carniato
Daniel Afonso
Aakansha Doshi
Tim Neutkens
6 authors
Signals are being adopted by popular frameworks, enabling code reuse and improved tooling. While merging between frameworks is unlikely, they are learning from each other and adopting shared practices. It is important to embrace the diversity of frameworks and libraries. Instead of merging, focus on standardizing the principles behind frameworks. Consider tradeoffs and benefits when choosing a framework, and explore different technologies to learn new ideas.
Managing React State: 10 Years of Lessons Learned
React Day Berlin 2023React Day Berlin 2023
16 min
Managing React State: 10 Years of Lessons Learned
Top Content
Watch video: Managing React State: 10 Years of Lessons Learned
This Talk focuses on effective React state management and lessons learned over the past 10 years. Key points include separating related state, utilizing UseReducer for protecting state and updating multiple pieces of state simultaneously, avoiding unnecessary state syncing with useEffect, using abstractions like React Query or SWR for fetching data, simplifying state management with custom hooks, and leveraging refs and third-party libraries for managing state. Additional resources and services are also provided for further learning and support.
The Epic Stack
React Summit US 2023React Summit US 2023
21 min
The Epic Stack
Top Content
Watch video: The Epic Stack
This Talk introduces the Epic Stack, a project starter and reference for modern web development. It emphasizes that the choice of tools is not as important as we think and that any tool can be fine. The Epic Stack aims to provide a limited set of services and common use cases, with a focus on adaptability and ease of swapping out tools. It incorporates technologies like Remix, React, Fly to I.O, Grafana, and Sentry. The Epic Web Dev offers free materials and workshops to gain a solid understanding of the Epic Stack.
Gateway to React: The React.dev Story
React Summit US 2023React Summit US 2023
32 min
Gateway to React: The React.dev Story
Watch video: Gateway to React: The React.dev Story
The Talk discusses the journey of improving React and React Native documentation, including the addition of interactive code sandboxes and visual content. The focus was on creating a more accessible and engaging learning experience for developers. The Talk also emphasizes the importance of building a human API through well-designed documentation. It provides tips for building effective documentation sites and highlights the benefits of contributing to open source projects. The potential impact of AI on React development is mentioned, with the recognition that human engineers are still essential.
Power Fixing React Performance Woes
React Advanced Conference 2023React Advanced Conference 2023
22 min
Power Fixing React Performance Woes
Top Content
Watch video: Power Fixing React Performance Woes
This Talk discusses various strategies to improve React performance, including lazy loading iframes, analyzing and optimizing bundles, fixing barrel exports and tree shaking, removing dead code, and caching expensive computations. The speaker shares their experience in identifying and addressing performance issues in a real-world application. They also highlight the importance of regularly auditing webpack and bundle analyzers, using tools like Knip to find unused code, and contributing improvements to open source libraries.
React Compiler - Understanding Idiomatic React (React Forget)
React Advanced Conference 2023React Advanced Conference 2023
33 min
React Compiler - Understanding Idiomatic React (React Forget)
Top Content
Watch video: React Compiler - Understanding Idiomatic React (React Forget)
Joe Savona
Mofei Zhang
2 authors
The Talk discusses React Forget, a compiler built at Meta that aims to optimize client-side React development. It explores the use of memoization to improve performance and the vision of Forget to automatically determine dependencies at build time. Forget is named with an F-word pun and has the potential to optimize server builds and enable dead code elimination. The team plans to make Forget open-source and is focused on ensuring its quality before release.
A Practical Guide for Migrating to Server Components
React Advanced Conference 2023React Advanced Conference 2023
28 min
A Practical Guide for Migrating to Server Components
Top Content
Watch video: A Practical Guide for Migrating to Server Components
React query version five is live and we'll be discussing the migration process to server components using Next.js and React Query. The process involves planning, preparing, and setting up server components, migrating pages, adding layouts, and moving components to the server. We'll also explore the benefits of server components such as reducing JavaScript shipping, enabling powerful caching, and leveraging the features of the app router. Additionally, we'll cover topics like handling authentication, rendering in server components, and the impact on server load and costs.
React Performance Debugging Masterclass
React Summit 2023React Summit 2023
170 min
React Performance Debugging Masterclass
Top Content
Featured WorkshopFree
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
Designing Effective Tests With React Testing Library
React Summit 2023React Summit 2023
151 min
Designing Effective Tests With React Testing Library
Top Content
Featured Workshop
Josh Justice
Josh Justice
React Testing Library is a great framework for React component tests because there are a lot of questions it answers for you, so you don’t need to worry about those questions. But that doesn’t mean testing is easy. There are still a lot of questions you have to figure out for yourself: How many component tests should you write vs end-to-end tests or lower-level unit tests? How can you test a certain line of code that is tricky to test? And what in the world are you supposed to do about that persistent act() warning?
In this three-hour workshop we’ll introduce React Testing Library along with a mental model for how to think about designing your component tests. This mental model will help you see how to test each bit of logic, whether or not to mock dependencies, and will help improve the design of your components. You’ll walk away with the tools, techniques, and principles you need to implement low-cost, high-value component tests.
Table of contents- The different kinds of React application tests, and where component tests fit in- A mental model for thinking about the inputs and outputs of the components you test- Options for selecting DOM elements to verify and interact with them- The value of mocks and why they shouldn’t be avoided- The challenges with asynchrony in RTL tests and how to handle them
Prerequisites- Familiarity with building applications with React- Basic experience writing automated tests with Jest or another unit testing framework- You do not need any experience with React Testing Library- Machine setup: Node LTS, Yarn
Server Components: The Epic Tale of Rendering UX
React Summit 2023React Summit 2023
26 min
Server Components: The Epic Tale of Rendering UX
Top Content
Watch video: Server Components: The Epic Tale of Rendering UX
This Talk introduces server components in React, which provide an intermediate format for rendering and offer advantages for both client-side and server-side rendering. Server components reduce bundle size on the client and improve search engine optimization. They abstract the rendering process, allowing for faster rendering and flexibility in choosing where to render components. While server components are still in the experimental stage, Next.js is a good starting point to try them out.
React Concurrency, Explained
React Summit 2023React Summit 2023
23 min
React Concurrency, Explained
Top Content
Watch video: React Concurrency, Explained
React 18's concurrent rendering, specifically the useTransition hook, optimizes app performance by allowing non-urgent updates to be processed without freezing the UI. However, there are drawbacks such as longer processing time for non-urgent updates and increased CPU usage. The useTransition hook works similarly to throttling or bouncing, making it useful for addressing performance issues caused by multiple small components. Libraries like React Query may require the use of alternative APIs to handle urgent and non-urgent updates effectively.
React at Scale with Nx
React Summit 2023React Summit 2023
145 min
React at Scale with Nx
Top Content
Featured WorkshopFree
Isaac Mann
Isaac Mann
We're going to be using Nx and some its plugins to accelerate the development of this app.
Some of the things you'll learn:- Generating a pristine Nx workspace- Generating frontend React apps and backend APIs inside your workspace, with pre-configured proxies- Creating shared libs for re-using code- Generating new routed components with all the routes pre-configured by Nx and ready to go- How to organize code in a monorepo- Easily move libs around your folder structure- Creating Storybook stories and e2e Cypress tests for your components
Table of contents: - Lab 1 - Generate an empty workspace- Lab 2 - Generate a React app- Lab 3 - Executors- Lab 3.1 - Migrations- Lab 4 - Generate a component lib- Lab 5 - Generate a utility lib- Lab 6 - Generate a route lib- Lab 7 - Add an Express API- Lab 8 - Displaying a full game in the routed game-detail component- Lab 9 - Generate a type lib that the API and frontend can share- Lab 10 - Generate Storybook stories for the shared ui component- Lab 11 - E2E test the shared component
Rock Solid React and GraphQL Apps for People in a Hurry
GraphQL Galaxy 2022GraphQL Galaxy 2022
29 min
Rock Solid React and GraphQL Apps for People in a Hurry
The Talk discusses the challenges and advancements in using GraphQL and React together. It introduces RedwoodJS, a framework that simplifies frontend-backend integration and provides features like code generation, scaffolding, and authentication. The Talk demonstrates how to set up a Redwood project, generate layouts and models, and perform CRUD operations. Redwood automates many GraphQL parts and provides an easy way for developers to get started with GraphQL. It also highlights the benefits of Redwood and suggests checking out RedwoodJS.com for more information.
GraphQL for React Developers
GraphQL Galaxy 2022GraphQL Galaxy 2022
112 min
GraphQL for React Developers
Featured Workshop
Roy Derks
Roy Derks
There are many advantages to using GraphQL as a datasource for frontend development, compared to REST APIs. We developers in example need to write a lot of imperative code to retrieve data to display in our applications and handle state. With GraphQL you cannot only decrease the amount of code needed around data fetching and state-management you'll also get increased flexibility, better performance and most of all an improved developer experience. In this workshop you'll learn how GraphQL can improve your work as a frontend developer and how to handle GraphQL in your frontend React application.
The Weird Things About React
React Day Berlin 2022React Day Berlin 2022
34 min
The Weird Things About React
Top Content
React has some weird and undocumented features like using the key attribute to remount components. The new beta docs and RFCs provide valuable insights into React's thinking and allow for proposing changes. React's composition story has evolved from mixins to higher order components to hooks. The upgrade to React 18 fixed TypeScript types but introduced issues with optional children. React warnings can be helpful but also annoying, and a library called React Reduce Stress can suppress them. React strict mode helps identify issues and supports new features, but it can cause double rendering in React 18. Overall, React is an interesting journey with its flaws and learning opportunities.
Emotional & Functional UI Animations in React
React Day Berlin 2022React Day Berlin 2022
28 min
Emotional & Functional UI Animations in React
Today's Talk discussed the importance of UI animations in React, both functional and emotional. Examples were given using CSS and Framer Motion, with a focus on user feedback and accessibility. Design guidelines and animation usage were highlighted, as well as the consideration of negative emotions in animations. The Talk also touched on designing 404 error pages and concluded with gratitude to the audience and organizers.
Best Practices and Advanced TypeScript Tips for React Developers
React Advanced Conference 2022React Advanced Conference 2022
148 min
Best Practices and Advanced TypeScript Tips for React Developers
Top Content
Featured Workshop
Maurice de Beijer
Maurice de Beijer
Are you a React developer trying to get the most benefits from TypeScript? Then this is the workshop for you.In this interactive workshop, we will start at the basics and examine the pros and cons of different ways you can declare React components using TypeScript. After that we will move to more advanced concepts where we will go beyond the strict setting of TypeScript. You will learn when to use types like any, unknown and never. We will explore the use of type predicates, guards and exhaustive checking. You will learn about the built-in mapped types as well as how to create your own new type map utilities. And we will start programming in the TypeScript type system using conditional types and type inferring.
TypeScript and React: Secrets of a Happy Marriage
React Advanced Conference 2022React Advanced Conference 2022
21 min
TypeScript and React: Secrets of a Happy Marriage
Top Content
React and TypeScript have a strong relationship, with TypeScript offering benefits like better type checking and contract enforcement. Failing early and failing hard is important in software development to catch errors and debug effectively. TypeScript provides early detection of errors and ensures data accuracy in components and hooks. It offers superior type safety but can become complex as the codebase grows. Using union types in props can resolve errors and address dependencies. Dynamic communication and type contracts can be achieved through generics. Understanding React's built-in types and hooks like useState and useRef is crucial for leveraging their functionality.
A Guide to React Rendering Behavior
React Advanced Conference 2022React Advanced Conference 2022
25 min
A Guide to React Rendering Behavior
Top Content
This transcription provides a brief guide to React rendering behavior. It explains the process of rendering, comparing new and old elements, and the importance of pure rendering without side effects. It also covers topics such as batching and double rendering, optimizing rendering and using context and Redux in React. Overall, it offers valuable insights for developers looking to understand and optimize React rendering.
Using useEffect Effectively
React Advanced Conference 2022React Advanced Conference 2022
30 min
Using useEffect Effectively
Top Content
Today's Talk explores the use of the useEffect hook in React development, covering topics such as fetching data, handling race conditions and cleanup, and optimizing performance. It also discusses the correct use of useEffect in React 18, the distinction between Activity Effects and Action Effects, and the potential misuse of useEffect. The Talk highlights the benefits of using useQuery or SWR for data fetching, the problems with using useEffect for initializing global singletons, and the use of state machines for handling effects. The speaker also recommends exploring the beta React docs and using tools like the stately.ai editor for visualizing state machines.
A Career As Software Engineer
React Advanced Conference 2022React Advanced Conference 2022
24 min
A Career As Software Engineer
Code will be imperfect and perishable, so testing and debugging are crucial. Building relationships and being generous with code reviews are important for teams. Code ownership should belong to the team, not individuals. Prioritizing functionality over consistency can lead to more efficient development. Growing into a tech lead role requires building relationships and coaching skills.
Deep Diving on Concurrent React
React Advanced Conference 2022React Advanced Conference 2022
29 min
Deep Diving on Concurrent React
The Talk discussed Concurrent React and its impact on app performance, particularly in relation to long tasks on the main thread. It explored parallelism with workers and the challenges of WebAssembly for UI tasks. The concepts of concurrency, scheduling, and rendering were covered, along with techniques for optimizing performance and tackling wasted renders. The Talk also highlighted the benefits of hydration improvements and the new profiler in Concurrent React, and mentioned future enhancements such as React fetch and native scheduling primitives. The importance of understanding React internals and correlating performance metrics with business metrics was emphasized.
Understanding React’s Fiber Architecture
React Advanced Conference 2022React Advanced Conference 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.
End-To-End Type Safety with React, GraphQL & Prisma
React Advanced Conference 2022React Advanced Conference 2022
95 min
End-To-End Type Safety with React, GraphQL & Prisma
Featured WorkshopFree
Sabin Adams
Sabin Adams
In this workshop, you will get a first-hand look at what end-to-end type safety is and why it is important. To accomplish this, you’ll be building a GraphQL API using modern, relevant tools which will be consumed by a React client.
Prerequisites: - Node.js installed on your machine (12.2.X / 14.X)- It is recommended (but not required) to use VS Code for the practical tasks- An IDE installed (VSCode recommended)- (Good to have)*A basic understanding of Node.js, React, and TypeScript
Inside Fiber: the in-depth overview you wanted a TLDR for
React Summit 2022React Summit 2022
27 min
Inside Fiber: the in-depth overview you wanted a TLDR for
This Talk explores the internals of React Fiber and its implications. It covers topics such as fibres and units of work, inspecting elements and parent matching, pattern matching and coroutines, and the influence of coroutines on concurrent React. The Talk also discusses effect handlers in React, handling side effects in components, and the history of effect handlers in React. It concludes by emphasizing the importance of understanding React internals and provides learning resources for further exploration.
Routing in React 18 and Beyond
React Summit 2022React Summit 2022
20 min
Routing in React 18 and Beyond
Top Content
Routing in React 18 brings a native app-like user experience and allows applications to transition between different environments. React Router and Next.js have different approaches to routing, with React Router using component-based routing and Next.js using file system-based routing. React server components provide the primitives to address the disadvantages of multipage applications while maintaining the same user experience. Improving navigation and routing in React involves including loading UI, pre-rendering parts of the screen, and using server components for more performant experiences. Next.js and Remix are moving towards a converging solution by combining component-based routing with file system routing.
Concurrent Rendering Adventures in React 18
React Advanced Conference 2021React Advanced Conference 2021
132 min
Concurrent Rendering Adventures in React 18
Top Content
Featured WorkshopFree
Maurice de Beijer
Maurice de Beijer
With the release of React 18 we finally get the long awaited concurrent rendering. But how is that going to affect your application? What are the benefits of concurrent rendering in React? What do you need to do to switch to concurrent rendering when you upgrade to React 18? And what if you don’t want or can’t use concurrent rendering yet?

There are some behavior changes you need to be aware of! In this workshop we will cover all of those subjects and more.

Join me with your laptop in this interactive workshop. You will see how easy it is to switch to concurrent rendering in your React application. You will learn all about concurrent rendering, SuspenseList, the startTransition API and more.
Cracking the Concurrent Mode
React Advanced Conference 2021React Advanced Conference 2021
30 min
Cracking the Concurrent Mode
Sudhanshu Yadav discusses the incremental concurrent feature in React 18 and the need for concurrent mode to provide a better user experience. Time slicing is the key pattern enabling concurrent features. Background rendering and unit of work are used to achieve asynchronous rendering and eventual consistency. Concurrent mode introduces a new pattern called differing for immediate rendering and adjusting based on available resources. React provides APIs for deferred updates and transitions. Implementing concurrent mode APIs can be complex, but it offers benefits like avoiding update starvation and reusing work. Scheduling and slots are used to control execution and dynamic FPS control. Handling multiple transitions can be challenging, but the React 18 working group discussions provide insights into the team's efforts to improve the user experience.
Living on the Edge
React Advanced Conference 2021React Advanced Conference 2021
36 min
Living on the Edge
The Talk discusses the future of React and introduces new APIs, including streaming rendering and server components. React Suspense allows for asynchronous loading of components and data fetching. The use of serverless computing, specifically Cloudflare Workers, is explored as a way to improve performance. The Talk emphasizes the potential for simplifying the React ecosystem and the excitement about the new API.
(Easier) Interactive Data Visualization in React
React Advanced Conference 2021React Advanced Conference 2021
27 min
(Easier) Interactive Data Visualization in React
Top Content
This Talk is about interactive data visualization in React using the Plot library. Plot is a high-level library that simplifies the process of visualizing data by providing key concepts and defaults for layout decisions. It can be integrated with React using hooks like useRef and useEffect. Plot allows for customization and supports features like sorting and adding additional marks. The Talk also discusses accessibility concerns, SSR support, and compares Plot to other libraries like D3 and Vega-Lite.
React, TypeScript, and TDD
React Advanced Conference 2021React Advanced Conference 2021
174 min
React, TypeScript, and TDD
Top Content
Featured WorkshopFree
Paul Everitt
Paul Everitt
ReactJS is wildly popular and thus wildly supported. TypeScript is increasingly popular, and thus increasingly supported.

The two together? Not as much. Given that they both change quickly, it's hard to find accurate learning materials.

React+TypeScript, with JetBrains IDEs? That three-part combination is the topic of this series. We'll show a little about a lot. Meaning, the key steps to getting productive, in the IDE, for React projects using TypeScript. Along the way we'll show test-driven development and emphasize tips-and-tricks in the IDE.
Web3 Workshop - Building Your First Dapp
React Advanced Conference 2021React Advanced Conference 2021
145 min
Web3 Workshop - Building Your First Dapp
Top Content
Featured WorkshopFree
Nader Dabit
Nader Dabit
In this workshop, you'll learn how to build your first full stack dapp on the Ethereum blockchain, reading and writing data to the network, and connecting a front end application to the contract you've deployed. By the end of the workshop, you'll understand how to set up a full stack development environment, run a local node, and interact with any smart contract using React, HardHat, and Ethers.js.
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
Rethinking Server State with React Query
React Summit 2020React Summit 2020
96 min
Rethinking Server State with React Query
Top Content
Featured Workshop
Tanner Linsley
Tanner Linsley
The distinction between server state and client state in our applications might be a new concept for some, but it is very important to understand when delivering a top-notch user experience. Server state comes with unique problems that often sneak into our applications surprise like:
- Sharing Data across apps- Caching & Persistence- Deduping Requests- Background Updates- Managing “Stale” Data- Pagination & Incremental fetching- Memory & Garbage Collection- Optimistic Updates
Traditional “Global State” managers pretend these challenges don’t exist and this ultimately results in developers building their own on-the-fly attempts to mitigate them.
In this workshop, we will build an application that exposes these issues, allows us to understand them better, and finally turn them from challenges into features using a library designed for managing server-state called React Query.
By the end of the workshop, you will have a better understanding of server state, client state, syncing asynchronous data (mouthful, I know), and React Query.
Getting Started with Suspense and Concurrent Rendering in React
React Summit 2020React Summit 2020
125 min
Getting Started with Suspense and Concurrent Rendering in React
Featured Workshop
Maurice de Beijer
Maurice de Beijer
React keeps on evolving and making hard things easier for the average developer.
One case, where React was not particularly hard but very repetitive, is working with AJAX request. There is always the trinity of loading, success and possible error states that had to be handled each time. But no more as the `<Suspense />` component makes life much easier.
Another case is performance of larger and complex applications. Usually React is fast enough but with a large application rendering components can conflict with user interactions. Concurrent rendering will, mostly automatically, take care of this.
You will learn all about using <Suspense />, showing loading indicators and handling errors. You will see how easy it is to get started with concurrent rendering. You will make suspense even more capable combining it with concurrent rendering, the `useTransition()` hook and the <SuspenseList /> component.
React Hooks Tips Only the Pros Know
React Summit Remote Edition 2021React Summit Remote Edition 2021
177 min
React Hooks Tips Only the Pros Know
Top Content
Featured Workshop
Maurice de Beijer
Maurice de Beijer
The addition of the hooks API to React was quite a major change. Before hooks most components had to be class based. Now, with hooks, these are often much simpler functional components. Hooks can be really simple to use. Almost deceptively simple. Because there are still plenty of ways you can mess up with hooks. And it often turns out there are many ways where you can improve your components a better understanding of how each React hook can be used.You will learn all about the pros and cons of the various hooks. You will learn when to use useState() versus useReducer(). We will look at using useContext() efficiently. You will see when to use useLayoutEffect() and when useEffect() is better.
Building Better Websites with Remix
React Summit Remote Edition 2021React Summit Remote Edition 2021
33 min
Building Better Websites with Remix
Top Content
Remix is a web framework built on React Router that focuses on web fundamentals, accessibility, performance, and flexibility. It delivers real HTML and SEO benefits, and allows for automatic updating of meta tags and styles. It provides features like login functionality, session management, and error handling. Remix is a server-rendered framework that can enhance sites with JavaScript but doesn't require it for basic functionality. It aims to create quality HTML-driven documents and is flexible for use with different web technologies and stacks.
Effective Testing Strategies for React Components
Effective Testing Strategies for React Components
Article
Testing the contract of a component by focusing on inputs and outputs.Utilizing Jest mock functions for testing function props and module mocks for external modules.Implementing the React Testing Library for rendering components and simulating user interactions.Addressing asynchronous behavior in tests using the findBy query and awaiting promises.Balancing test coverage between lower-level and higher-level components.Testing React components effectively involves focusing on the contract of the component, which means understanding the inputs and outputs. This mindset helps ensure that tests are meaningful and maintainable. Instead of delving into implementation details, the aim is to test observable behavior that a user would interact with.Components have various inputs and outputs. Inputs include props, user interactions, and responses from external functions, while outputs are the rendered UI and calls to external functions. Testing begins by rendering the component and simulating user interactions to observe the outputs.Jest mock functions are essential for testing function props. They allow you to simulate and make assertions on functions passed as props. For example, if a component receives a function to handle form submission, a Jest mock function can verify that this function is called with the correct arguments.Jest module mocks are another powerful tool for handling external modules. They enable you to mock out any JavaScript module that your component depends on, ensuring that tests remain isolated from external dependencies. This is particularly useful when dealing with API calls, as it allows you to simulate responses without hitting a real server, thereby avoiding flakiness and improving test reliability.When testing asynchronous behavior, such as loading data from an API, it's crucial to handle promises correctly. The findBy query from the React Testing Library is an excellent way to wait for elements to appear on the page. It returns a promise that resolves when the element is found, allowing you to await its presence before making assertions.Organizing tests effectively involves making judgment calls about what to test at each level. Lower-level component tests focus on the detailed behavior of individual components, while higher-level tests ensure that components integrate correctly. This balance helps maintain a comprehensive test suite without excessive duplication.In addition to testing visible outputs, it's important to confirm that components make the correct external calls. This involves asserting not only on the presence of elements but also on the calls made to external functions, such as ensuring that the correct API endpoints are hit with the appropriate parameters.By focusing on the contract of a component and using tools like Jest and the React Testing Library, developers can create robust and reliable tests. This approach emphasizes testing what matters most to users and ensures that components behave as expected, both in isolation and when integrated with others.
Mastering Documentation with Nextra: A Seamless Experience
Mastering Documentation with Nextra: A Seamless Experience
Article
Introduction to Nextra as a tool for generating documentation websites. Benefits of using Next.js for creating documentation sites. Key features of Nextra, including markdown support and automatic search. Customization options and ease of content management with Nextra. Use cases and examples of successful Nextra implementations. Creating and maintaining documentation for multiple projects can be a daunting task, especially when each project requires a unique setup. In the realm of software development, it's crucial to have a streamlined and efficient way to manage these documents. Nextra emerges as a powerful tool, enabling the generation of full-featured documentation websites in a matter of minutes. Nextra leverages the capabilities of Next.js, a well-known and robust framework, to provide a seamless experience for developers. The familiarity of Next.js APIs means there's no need to learn a new tool, which significantly reduces the learning curve. By utilizing Next.js, Nextra offers a solid foundation, ensuring that the documentation process is both reliable and efficient. One of the standout features of Nextra is its use of markdown and MDX files. Instead of dealing with complex JavaScript files, developers can focus solely on the content. This approach simplifies the process, allowing for a more intuitive management of routes and site structure. The file system mirrors the website's structure, making it easy to visualize the final product without any additional configuration. Nextra also boasts a suite of features designed to enhance the user experience. Automatic table of contents generation and built-in search functionality are just a few of the conveniences offered. The search feature, in particular, eliminates the need for external services, providing a fast and efficient way to navigate documentation. Customization is another area where Nextra shines. While it maintains an opinionated framework, there are options for tweaking the theme color and overriding styles with custom CSS. This flexibility ensures that while the framework provides a consistent look, there's room for personalization to meet specific branding needs. Beyond documentation, Nextra is versatile enough to support other web formats such as blogs and portfolio sites. This versatility, coupled with features like dark mode and React component integration, makes it a comprehensive solution for various web projects. Several successful implementations showcase the potential of Nextra. Projects like Minion.js and Turbo have utilized its features to create fast, aesthetically pleasing documentation sites. These examples highlight Nextra's ability to handle complex requirements while maintaining simplicity in content management. For developers looking to manage documentation collaboratively, Nextra offers features like feedback links that integrate with GitHub issues. This integration encourages community contributions, making it easier for users to provide feedback and suggest improvements. Localization is another area where Nextra excels, with built-in support for multiple languages. Developers can easily manage localized content by using different file extensions, enabling a seamless language switcher for users. Despite its many features, Nextra remains easy to deploy. It can be self-hosted, providing flexibility for those who prefer to manage their own infrastructure. The inclusion of Next.js features like SSR, SSG, and ISR ensures that even dynamic content can be handled with ease. Nextra stands out as a tool that simplifies the creation and management of documentation sites. With its intuitive setup, powerful features, and flexibility, it offers a solution that is both comprehensive and easy to use. As more developers adopt Nextra, it promises to transform the way documentation is created and maintained in the software development community.
Enhancing React Performance with Automated Memoization: An Insight into React Forget
Enhancing React Performance with Automated Memoization: An Insight into React Forget
Article
Memoization as a compromise between code clarity and performance.React Forget aims to automate memoization and improve developer experience.UseMemo and react.memo APIs increase performance but complicate code.React Forget explores escape analysis and type inference to optimize memoization.Open-source strategy and Meta's internal testing provide a robust foundation.Memoization is a common technique used in React to optimize performance, but it often comes at the cost of code clarity. When developers employ methods like useMemo and react.memo, they introduce additional logic that can clutter code and make it harder to read and maintain. This challenge is a compromise, trading off the simplicity of original logic for enhanced performance. But this raises an important question: why do developers need to make this trade-off in the first place?The underlying issue lies in the way React handles component re-rendering. React requires explicit instructions about which components depend on which data points to prevent unnecessary re-renders. For instance, if a component's heading changes, React might unnecessarily re-render not only the heading but also a list of videos filtered based on specific criteria. Even if these videos haven't changed, the entire component function runs again, leading to performance inefficiencies.To tackle this, developers typically use React's useMemo and react.memo APIs. UseMemo ensures that the logic for computing data, like a filtered video list, only executes when its dependencies change. Meanwhile, react.memo prevents components from re-rendering if their props remain unchanged. While these tools can significantly enhance performance, they also complicate the codebase, detracting from React's original promise of declarative rendering.React Forget, a new compiler at Meta, is designed to address these challenges by automating the memoization process. The goal is to eliminate the need for useMemo, react.memo, and useCallback, streamlining the developer experience. React Forget leverages escape analysis to identify which values require memoization, focusing only on those that impact the function's return value. Additionally, it uses type inference to avoid memoizing primitive values like array lengths.This approach not only simplifies the code but also aligns with React's vision of making UI development a straightforward function of data. By automating memoization, developers can focus on building the core product experience without getting bogged down in performance-related logic.The initiative to open-source React Forget is underway, although it is currently being refined within Meta's ecosystem. The company tests it rigorously against its internal applications, which operate at a scale that most developers do not encounter. This extensive testing ensures that when React Forget is released to the open-source community, it will be robust and well-documented, ready to support a wide range of applications.React Forget is particularly exciting because it anticipates future applications beyond client-side React. While it currently focuses on optimizing client-side interactions, it has the potential to enhance server-side rendering (SSR) by identifying and eliminating unnecessary code. This capability indicates a broader vision for React Forget, one that could eventually benefit React Native and other frameworks.In summary, React Forget represents a significant step towards a more ergonomic React development experience. By automating memoization, it aims to preserve the declarative nature of React while enhancing performance. This innovation promises to make React applications not only more efficient but also easier to develop and maintain. As React Forget moves closer to open-source release, it holds the potential to transform how developers approach performance optimization in React applications.
Navigating the Epic Stack: A Practical Guide for Web Developers
Navigating the Epic Stack: A Practical Guide for Web Developers
Article
The Epic Stack offers a structured project starter and reference for web developers.Decision documents assist in understanding the rationale behind tool choices.The Epic Stack emphasizes minimizing external services to reduce complexity.Guiding principles promote adaptability and simplicity in development.Epic Web Dev provides comprehensive documentation and workshops for mastering the Epic Stack.Building full-stack applications can often seem daunting due to the plethora of tools and technologies available. The fear of making the wrong decision can lead to analysis paralysis, where developers are stuck in indecision due to the potential high risk of choosing incorrectly. However, the Epic Stack serves as a comprehensive solution for web developers, offering both a project starter and a reference guide.The Epic Stack is built on the Remix framework, a favorite choice for its efficiency and compatibility with React. It simplifies the decision-making process by providing a curated set of tools that can be easily adopted by developers. The stack includes essential services like Fly.io for hosting, GitHub Actions for deployment, and Resend for email services, ensuring that the development process is as streamlined as possible.A significant aspect of the Epic Stack is its emphasis on limiting the number of services used in a project. By reducing dependency on third-party services, developers can maintain greater control over their projects and reduce complexity. This principle ensures that developers can focus on building robust applications without being bogged down by unnecessary external dependencies.Adaptability is another core principle of the Epic Stack. The fast-paced nature of web development demands that tools and technologies be flexible enough to accommodate changes. The Epic Stack is designed to be easily modifiable, allowing developers to swap out components as needed without disrupting the overall architecture of their applications. This adaptability helps developers stay current with industry trends and technological advancements.Documented decision-making is a key feature of the Epic Stack. Decision documents provide insight into the thought process behind choosing specific tools and services. These documents help developers understand the pros and cons of each choice, making it easier to evaluate whether these decisions align with their own project requirements.Epic Web Dev complements the Epic Stack by offering extensive documentation and workshops. These resources guide developers through the intricacies of the stack, ensuring they have a solid understanding of the underlying technologies. This educational aspect is particularly valuable for those looking to deepen their knowledge of full-stack development.The guiding principles of the Epic Stack also prioritize simplicity, with a focus on including only the most common use cases. This approach reduces the clutter in the initial setup and allows developers to get their projects off the ground quickly. By minimizing setup friction, developers can avoid spending excessive time on configuration and instead concentrate on building features that matter.Offline development capabilities are another noteworthy feature of the Epic Stack. Being able to work without an internet connection not only enhances productivity but also increases resilience against external disruptions. This feature ensures that developers can continue to work smoothly, even in environments with unreliable connectivity.Ultimately, the Epic Stack aims to provide a solid foundation for web developers. By offering a set of guiding principles, comprehensive documentation, and a reliable project starter, it empowers developers to make informed decisions and build applications with confidence. The combination of the Epic Stack and Epic Web Dev equips developers with the tools and knowledge needed to succeed in the ever-evolving world of web development.The Epic Stack and its accompanying resources are designed to tackle the challenges of modern web development. By offering a well-structured and opinionated approach, the stack provides developers with the confidence to make decisions and build applications efficiently. Whether you're starting a new project or enhancing an existing one, the Epic Stack serves as a valuable guide on your development journey.
Navigating the Quirks and Challenges of React Development
Navigating the Quirks and Challenges of React Development
Article
Understanding React's warning system and its implications for development.The evolution of React's component composition techniques from mixins to hooks.The challenges and solutions related to TypeScript integration in React applications.Strategies for managing and suppressing warnings in React applications.The impact of React's strict mode on development practices.React is a powerful tool in the developer's arsenal, but like all tools, it comes with its quirks. One of the most noticeable features of React is its warning system. These warnings serve as gentle reminders that something might not be quite right in your code, such as the infamous "Can't perform a React state update on unmounted component." While they can be frustrating, they are invaluable in maintaining clean and efficient code. These warnings don't halt your application like errors, but they do nudge you to make necessary adjustments, ensuring your application runs smoothly.The evolution of React has been a journey through various methods of component composition. Initially, mixins were the go-to solution, offering a way to reuse code across components. However, they were soon deemed problematic, leading developers to adopt higher-order components. These allowed for a more functional programming style but often resulted in unmanageable code. Eventually, React introduced hooks, which provided a more intuitive and maintainable approach to handling state and lifecycle methods.Documentation plays a crucial role in understanding the intricacies of React. While the official React documentation is comprehensive, many developers find additional insights through unofficial sources like Twitter and blog posts. These platforms often reveal undocumented features or best practices, such as using the key attribute to remount components. Such tips can be game-changers in specific scenarios, especially when dealing with poorly constructed components that misuse hooks.TypeScript has become an integral part of modern React development, offering type safety and enhancing code quality. However, integrating TypeScript into React projects isn't without challenges. The community has debated the use of React.fc due to its implicit handling of children, leading to confusion and potential bugs. Thankfully, improvements in React's TypeScript definitions have addressed many of these issues, allowing developers to explicitly define component props and ensuring a more predictable development experience.Dealing with warnings from third-party packages can be particularly frustrating. These warnings clutter the console, making it difficult to focus on the logs that matter. One approach to managing this issue is creating scripts to suppress specific warnings, giving developers peace of mind and a cleaner development environment. This practice can be extended into helpful tools and libraries that simplify the process across projects.React's strict mode is another feature that has significant implications for development. While it serves as a valuable tool for identifying potential issues in your application, it introduces changes that can catch developers off guard. For instance, strict mode in React 18 renders components twice in development, a behavior that can expose improper use of useEffect. Although this can be frustrating, it forces developers to write cleaner, more predictable code, which is beneficial in the long run.React's journey has been one of constant evolution, with each iteration bringing new features and challenges. As developers, it's crucial to stay informed and adaptable, leveraging both official and unofficial resources to navigate the complexities of React development. Despite its quirks, React remains a powerful and flexible tool, capable of building robust and dynamic web applications.
Enhancing User Experience with Multi-Threaded React Applications
Enhancing User Experience with Multi-Threaded React Applications
Article
Understanding the impact of slow and unresponsive applications on user experience.Exploring the event loop and its role in application performance.Utilizing web workers to manage large tasks without blocking the main thread.Comparing concurrent mode and web workers in handling long-running tasks.Practical use cases and challenges of implementing web workers in React applications.User experience is crucial in application development. A seamless and responsive interface keeps users engaged and satisfied. Slow or unresponsive applications can drive users away, highlighting the need for efficient performance management.One major issue in application performance is the event loop. It processes JavaScript code and events like mouse clicks in a single thread. When a task takes too long, the event loop gets blocked, freezing the UI. This is evident when sorting a large list using a slow algorithm like bubble sort, resulting in a frozen application.To improve user experience, we must prevent long tasks from blocking the event loop. This is where web workers come in. They allow tasks to run in parallel threads, freeing the main thread for UI updates. By offloading heavy tasks to web workers, we prevent the UI from freezing, enhancing responsiveness.Web workers operate in a separate execution context. We create a worker instance using the new worker API, send tasks via worker.postMessage, and listen for completion with event listeners. This ensures the main thread remains unblocked while heavy tasks run concurrently.While concurrent mode in React appears similar, it's based on context-switching, not true parallelism. It breaks tasks into subtasks, handling them synchronously. Web workers, however, leverage CPU cores for true parallelism, enabling real-time message passing and task management.Understanding the distinction between threads and CPU cores is crucial. Modern machines have multi-core processors, allowing separate threads to run in different cores. This architecture supports parallel execution, crucial for managing complex tasks without UI lag.Despite the advantages, implementing web workers poses challenges. Setting up message-passing instances and managing event listeners adds complexity. Monitoring worker status is difficult, as messages are asynchronous. Coordinating multiple web workers further complicates development.Libraries like Commlink and UseWebWorkerHook simplify web worker implementation. UseWebWorkerHook, for instance, allows defining long-running functions and accessing them with minimal code. This approach streamlines the integration of web workers into React applications.Practical use cases for web workers include CPU-intensive tasks like virtual DOM diffing, image processing, and canvas drawing. These tasks benefit from parallel execution, improving performance without blocking the main thread.However, web workers are not suitable for I/O-bound tasks or DOM manipulation, as they lack access to the document object and local storage. Careful consideration is necessary to determine when to use web workers, balancing complexity with performance gains.Incorporating web workers into React applications can significantly enhance user experience by maintaining responsiveness and preventing UI freezes. By leveraging parallel execution, developers can manage complex tasks efficiently, ensuring a smooth and engaging user experience.
Mastering Application Monitoring with Sentry: Techniques and Tools
Mastering Application Monitoring with Sentry: Techniques and Tools
Article
Utilizing the Sentry SDK for transaction management.Implementing distributed tracing to identify performance bottlenecks.Leveraging session replay for real-time user interaction insights.Configuring source maps for detailed error tracking.Setting up alerts and issue assignments for efficient team response.Effective application monitoring is crucial for maintaining optimal performance and user satisfaction. It involves tracking user interactions, identifying bottlenecks, and ensuring quick resolutions to emerging issues. One powerful tool that developers can leverage for this purpose is Sentry. This article delves deep into how Sentry can be utilized to monitor applications effectively, focusing on distributed tracing, session replay, and error tracking.The first step in utilizing Sentry is setting up the Software Development Kit (SDK) to manage transactions. The SDK is designed to handle the finalization of transactions seamlessly. By borrowing transactions momentarily to append additional data, developers can allow the SDK to conclude these transactions and return them to the client. This capability is crucial when dealing with complex applications that require precise monitoring and error tracking.Distributed tracing is a key feature of Sentry that allows developers to track the execution of requests across various parts of an application. This feature is particularly useful for identifying performance bottlenecks. For instance, if a user reports that a particular function, like updating flashcards, takes too long, distributed tracing can pinpoint the exact query or process causing the delay. By examining the trace, developers can focus on optimizing the specific part of the code responsible for the slowdown, such as a database query or an HTTP request.Session replay is another powerful feature that provides insight into user interactions with the application. It records the Document Object Model (DOM) for each user, enabling developers to observe how users navigate and interact with the app. This feature is triggered by specific events, such as errors, and captures the user's actions leading up to the issue. By analyzing session replays, developers can gain a better understanding of user behavior and identify potential areas for improvement.Configuring source maps is essential for detailed error tracking in production environments. Source maps allow developers to trace back minified code to the original source code, providing a clear view of the line of code responsible for an error. This feature is particularly beneficial when combined with Sentry's suspect commit feature, which suggests the specific commit that may have introduced the error. By linking errors directly to the source code, developers can quickly resolve issues and maintain application stability.Alerts and issue assignments are crucial for efficient team response to application issues. Sentry allows for the creation of custom alerts based on specific criteria, such as the number of errors within a certain timeframe. These alerts can be configured to notify team members through various channels, including email and Slack, ensuring that issues are addressed promptly. Additionally, issue assignments can be automated based on code ownership, ensuring that the right team member is notified of any issues related to their code.Integrating Sentry with other tools and platforms further enhances its capabilities. For example, connecting Sentry with GitHub enables seamless issue tracking and resolution. Developers can automatically link Sentry issues to GitHub commits, streamlining the debugging process and improving collaboration among team members. This integration is part of Sentry's commitment to providing a developer-first monitoring solution that prioritizes actionable insights over generic error reporting.The process of setting up Sentry for an application involves several key steps. Initially, developers need to create a new project within Sentry and configure source maps to enable detailed error tracking. Adding event context and custom tags further enhances the monitoring capabilities, allowing for more precise filtering and searching of issues. Finally, setting up alerts and issue assignments ensures that the team is always prepared to respond to any issues that may arise.The combination of distributed tracing, session replay, and source maps provides a comprehensive monitoring solution that empowers developers to maintain high-performing applications. By focusing on actionable insights and seamless integration with existing tools, Sentry enables teams to efficiently manage their applications and provide a superior user experience.In summary, mastering application monitoring with Sentry involves utilizing its powerful features to track transactions, identify bottlenecks, and resolve issues promptly. By implementing distributed tracing, leveraging session replay, and configuring source maps, developers can gain a comprehensive understanding of their application's performance. Setting up alerts and issue assignments further enhances the team's ability to respond to issues quickly, ensuring that users enjoy a smooth and seamless experience.
Mastering Essential TypeScript Patterns for React Development
Mastering Essential TypeScript Patterns for React Development
Article
Introduction of essential TypeScript patterns to improve React development.Exploration of children, spreading props, either-or, generic components, and context patterns.Explanation of how to implement and utilize TypeScript patterns effectively.Discussion on the challenges and solutions in managing component properties.Insight into using context selectively to enhance performance and maintainability.Developing with React and TypeScript can be daunting, especially when standard resources often lean heavily on JavaScript. However, integrating TypeScript into React development offers safety, efficiency, and enjoyment. The focus here is on seven essential TypeScript patterns that can greatly enhance your React applications.Understanding and implementing these patterns can transform how you build applications. We'll explore how these patterns work and why they're beneficial, using examples that, while simplified, demonstrate their core functionalities.The first pattern to address is the use of children in components. This is a common property that must be typed correctly to handle various types of child content. By utilizing the 'props with children' interface from React, we can ensure that our components are prepared to handle strings, numbers, Booleans, elements, and lists, enhancing clarity and correctness.Next, we delve into the spreading props pattern. This involves mirroring the properties of a component to extend them with custom ones. A practical example is customizing button components to include additional properties like 'outline' or 'icon'. While React provides interfaces for this, such as 'button.html.attributes', it can become cumbersome. Instead, accessing properties via the JSX namespace can be more effective, though it has its quirks, like challenges with extending interfaces.When dealing with components that need to conform to one of several interfaces, the either-or pattern becomes essential. This pattern ensures that components only accept valid combinations of properties. For instance, a table component might require an action button to either have a link property or an onClick callback, but not both. By using TypeScript's narrowing capabilities, we can enforce these rules more cleanly.Generic components allow us to handle multiple types effectively. This is particularly useful in components like tables that display different data types in various columns. By using generic types, we can ensure that our components are flexible yet type-safe. However, caution is needed as React's memoization can strip away these generic types, which requires either adjusting component types or modifying global memo function types.Context in React is a powerful tool, especially when dealing with global states. However, a simple context might cause all consumers to re-render when any property changes, which isn't efficient. Instead, using a selectable context allows for selective rendering based on specific property changes. This approach can significantly reduce unnecessary re-renders, improving application performance.Implementing these patterns requires a deep understanding of both React and TypeScript. The patterns discussed provide a robust foundation for creating efficient, scalable applications. By mastering these patterns, developers can navigate the complexities of TypeScript in React development with greater ease and confidence.These patterns are not just theoretical; they are practical solutions to real-world challenges faced by React developers. As you continue to integrate these patterns into your work, you'll find that they not only improve code safety and efficiency but also enhance the overall development experience.
Unpacking React's Server Components: Balancing Client and Server Side Rendering
Unpacking React's Server Components: Balancing Client and Server Side Rendering
Article
Introduction to server components as a new feature in ReactExplanation of client-side rendering with a relatable analogyComparison of client-side and server-side rendering benefits and limitationsOverview of React's server components offering a balance between client and server-side renderingPractical insights into using server components, including automatic code splitting and bundle size reductionReact's server components are an exciting development in the world of web development. They offer a new way to manage the complexities of rendering in React applications. This innovation seeks to blend the best of both client-side and server-side rendering, providing developers with a more efficient way to build fast and responsive web applications.To understand the concept of server components, it's helpful to start with the basics of client-side rendering. Imagine a scenario where someone wants to build a sandcastle on a beach but has no tools. This situation is akin to client-side rendering, where the browser is responsible for assembling the website using resources provided by the server, such as JavaScript and HTML files. The browser, like the person building the sandcastle, has to do all the work to create the final product.Client-side rendering is advantageous for subsequent page loads because once the initial setup is complete, only the necessary JavaScript is refreshed when navigating different routes. However, it requires the client to do significant work upfront, which can be resource-intensive and lead to slower initial page loads.Server-side rendering (SSR) offers a different approach. In this method, the server builds the complete HTML page, which is then sent to the client. This process ensures that users see content faster, as they don't have to wait for the client to assemble the page. However, SSR can lead to higher server costs because the server must process each page request fully.React's server components aim to combine the strengths of both client-side and server-side rendering. By using server components, developers can choose which parts of a page should be rendered on the server and which should remain on the client. This flexibility allows for more efficient rendering and can significantly reduce the bundle size since server-side logic does not need to be shipped to the client.With server components, automatic code splitting becomes a reality. Traditionally, developers used React.lazy to load components as needed, but server components handle this automatically. The server decides which components are necessary for the initial render, optimizing the delivery of content to the client.Another advantage of server components is the reduced need for data fetching from the client. Since server components can make direct calls to the server, they can retrieve data faster than typical client-side fetch calls. However, it's important to note that server components do not handle client-specific features such as state or effects, which are exclusive to client components.Using server components in React is straightforward. Developers can indicate a component as a server component by using a .server.js extension. In frameworks like Next.js, components in the app directory are server components by default, but developers can opt for client-side rendering with a simple directive.Server components are still experimental, so it's advisable to test them in non-production environments. The React team continues to refine this feature, gathering feedback and making improvements.Server components offer a compelling solution for developers looking to optimize their React applications. By leveraging this feature, developers can enhance performance, reduce bundle sizes, and provide a smoother user experience. As the React team continues to develop server components, they promise to be an invaluable tool in the developer's toolkit.
Unraveling React Server Components and Their Impact on Web Development
Unraveling React Server Components and Their Impact on Web Development
Article
React Server Components run exclusively on the server side, producing a server-side representation of the virtual DOM.Next.js provides a seamless integration of React Server Components with Server-Side Rendering for optimized performance and developer experience.Selective hydration and streaming server-side rendering in React 18 improve load times and interactivity by processing components incrementally.Caching strategies in Next.js, including fetch cache, React cache, and unstable cache, enhance efficiency by storing frequently accessed data.Edge and Node runtimes offer distinct advantages, with Edge providing low latency and Node offering versatile application support.React Server Components (RSC) are a significant development in web technology. These components are designed to run exclusively on the server side, producing a server-side representation of the virtual DOM. This server-side representation, known as the RSC payload, outlines the placement of each component in the DOM structure. This is where frameworks like Next.js play a crucial role, taking the RSC payload and server-generated HTML, and sending them to the client, which is the user's browser.On the client side, the browser reads this server-side virtual DOM and starts constructing its version, adding necessary client-side components to the tree. This process, called hydration, is vital for ensuring that the application becomes interactive. While React Server Components differ from Server-Side Rendering (SSR), they can be used in tandem for enhanced efficiency. Integrated frameworks like Next.js simplify this process by efficiently handling both RSC and SSR, rendering both server-side and client-side components into HTML.React Server Components are particularly beneficial for tasks like data fetching, handling sensitive information, and executing heavy dependencies on the server side. They help in reducing client-side code, improving security, and enhancing network latency. This ultimately results in optimized SEO and a better user and developer experience.React 18 introduced streaming and selective hydration concepts. Streaming allows components to be sent from the server to the client as they are ready, eliminating the need to wait for the entire page generation before content is sent. This feature, supported by frameworks like Next.js, ensures that websites remain quick and responsive. Selective hydration, on the other hand, enables React to hydrate components incrementally, starting with those ready first. This approach reduces waiting times and improves performance.Next.js extends the capabilities of React Server Components with various caching strategies. Fetch cache automatically caches fetch requests, while React cache memoizes requests within a single route. Unstable cache, although experimental, offers the potential to cache requests across routes. These caching mechanisms minimize unnecessary data fetching, optimizing performance and reducing load times.Edge and Node runtimes in Next.js provide distinct advantages. Edge runtime is designed for low latency, executing code closer to the user's location. This is ideal for tasks like instant messaging and geolocation services. Node runtime, on the other hand, offers versatility and is suited for a wide range of applications. Choosing between the two depends on the specific needs of the application, such as latency requirements and supported features.Understanding server actions and their application in both server and client components is key to leveraging React Server Components effectively. Server actions allow for server-side code execution within client components, enhancing the flexibility of application development. While server actions are not suitable for all scenarios, they offer a streamlined approach for tasks like form submissions and database interactions.As web development continues to evolve, React Server Components, along with the capabilities of Next.js, are shaping the future landscape. By combining server-side efficiency with client-side interactivity, these technologies provide a robust foundation for building scalable and performant web applications.
Mastering the UseEffect Hook in React: A Practical Guide
Mastering the UseEffect Hook in React: A Practical Guide
Article
Understanding the UseEffect Hook's Purpose and FunctionalityIdentifying Common Mistakes and PitfallsUtilizing UseEffect for Side Effects Like Data FetchingImplementing Effective Cleanup FunctionsExploring UseEffect's Asynchronous NatureThe UseEffect Hook in React is a powerful tool for managing side effects in functional components. Introduced with React 16.8, UseEffect has become an essential part of modern React development, replacing lifecycle methods like componentDidMount and componentDidUpdate in class components. However, using it effectively requires a deep understanding of its behavior and potential pitfalls.UseEffect is essentially a hook that accepts two parameters: a callback function and a dependency array. The callback function, better described as a setup function, defines what side effect to perform. The dependency array dictates when the effect should run. This hook is versatile, but like a Swiss Army knife, it must be used with caution. Misusing UseEffect can lead to performance issues and bugs.One of the primary reasons to use UseEffect is to handle side effects such as data fetching, timers, or interacting with external APIs. When a component mounts, UseEffect can be set to run a callback function once, typically by passing an empty array as the dependency. This is useful for fetching data that should only occur once when the component is first rendered. For example, fetching a list of articles from a backend API can be done efficiently by leveraging this feature.In cases where the effect depends on specific variables, such as fetching data based on a category ID, these variables should be included in the dependency array. This ensures that the effect re-runs whenever the specified dependencies change. However, it's crucial to avoid creating infinite loops by incorrectly setting dependencies.UseEffect operates asynchronously, allowing React to render updates without blocking the main thread. This non-blocking behavior is achieved by utilizing the task queue, ensuring that the browser can update the UI promptly. Understanding the event loop and the role of the task queue in JavaScript can help developers make the most of UseEffect's asynchronous nature.Sometimes, side effects involve operations that need cleanup, such as removing event listeners or aborting network requests. UseEffect can return a cleanup function that React calls before the component unmounts or before re-running effects due to dependency changes. Properly implemented cleanup functions prevent memory leaks and stale data issues.While UseEffect is a flexible tool, there are situations where it's not necessary. For instance, if you're filtering data or making computations based on state or props, consider using useMemo or useCallback hooks instead. These hooks offer memoization capabilities, reducing unnecessary re-renders and improving performance without relying on UseEffect.Developers should also be cautious about using UseEffect for triggering parent component events or handling state updates. Often, these operations can be more directly and efficiently managed within event handlers or component logic, avoiding unnecessary re-renders and complexity.When implementing data fetching with UseEffect, it's important to consider race conditions, especially if users can trigger rapid state changes. Utilizing the AbortController API allows you to cancel ongoing network requests when dependencies change, ensuring that data remains consistent with the latest state.By understanding and applying these principles, developers can harness the full potential of the UseEffect Hook, creating efficient and bug-free React applications. Avoiding common pitfalls and implementing best practices will lead to cleaner, more maintainable code.
Navigating the Shift to React Server Components
Navigating the Shift to React Server Components
Article
Incremental migration strategy for server componentsImportance of maintaining the existing mental modelBenefits and challenges of using server componentsGuidance on data fetching and component migrationHandling server load and caching complexitiesEmbracing server components is a significant shift for any development team, particularly for those working with existing applications. The key to a successful transition is adopting an incremental migration strategy. This approach allows for a gradual shift, minimizing risks associated with large-scale changes. It's crucial to keep the migration process step-by-step, ensuring that the existing mental model of the application is preserved as much as possible.When transitioning to server components, remember that not all applications will benefit equally. The decision to migrate should be based on the specific needs and structures of your application. For example, reducing the amount of JavaScript needed on the client-side can be a compelling reason to use server components. They can also provide powerful features like cache invalidation that benefit all users, not just the current one.Server components offer exciting possibilities, but they also introduce new challenges, especially when dealing with data fetching. A common mistake is attempting to render dynamic data in server components using third-party libraries. This can lead to inconsistencies, as server components don't automatically re-render when client-side data changes. The recommended approach is to use server components mainly for data loading, while client components handle dynamic data interactions.When planning a migration, start by familiarizing yourself with the latest documentation and resources. Inventory your existing utilities, shared code, and third-party libraries to assess compatibility with server components. Consider the deployment, testing, and authentication aspects of your application early in the process, even if they don't need immediate changes.In terms of performance, using server components may increase server load, but they can also lead to a more efficient distribution of resources. By caching static parts of a page while keeping dynamic sections flexible, developers can reduce the overall load on servers. This strategy requires a careful balance between server-side and client-side rendering, ensuring a seamless user experience.For those using React Query or similar libraries, it's advisable to maintain existing client-side caching logic during the migration. This approach allows you to leverage the benefits of server components without disrupting the current data fetching processes. As you progress, you can gradually opt into the advanced caching features offered by server components.As server components continue to evolve, thorough testing is essential before deploying them in production environments. While they offer new paradigms for building web applications, developers must adapt to their concurrent features and potential bugs. This adaptation often reveals issues in existing code, making the transition an opportunity to refine and optimize applications.The journey to server components is not without challenges, but the potential benefits make it a worthwhile endeavor. By planning carefully, maintaining flexibility, and embracing new paradigms step-by-step, developers can harness the power of server components to build more efficient and responsive web applications.
Optimizing Software Development with Nx: A Guide to Monorepos and Dependency Management
Optimizing Software Development with Nx: A Guide to Monorepos and Dependency Management
Article
Understanding the advantages of using Nx in monorepo environments.Effective use of generators and executors to streamline code management.Importance of dependency management and modular architecture.Implementing caching and CI/CD with Nx for efficient workflows.Strategies for managing large codebases with Nx plugins and tools.Managing a large-scale software project involves navigating complex codebases and dependencies. Nx simplifies these challenges with its monorepo management capabilities. It provides tools for managing multiple projects within a single repository, ensuring atomic changes, simplified code sharing, and a unified dependency set.Nx offers features like controlled code sharing and consistent coding practices. These are achieved through its ability to parse TypeScript and JavaScript code, automatically drawing connections between projects. This parsing helps in understanding how different projects relate to one another, an essential feature for maintaining a coherent architecture.Setting up a monorepo with Nx allows for effective command execution. Through its executors, tasks such as build, test, and lint are streamlined. The 'Nx Affected' command is particularly useful as it runs commands only on projects impacted by code changes, thereby saving time and resources. Caching, both local and distributed, further accelerates runtimes by reusing previous outputs when inputs remain unchanged.Dependency management is crucial in large-scale projects. Nx offers a clear architecture diagram that visualizes dependencies, ensuring accurate task execution order. Libraries within a monorepo are categorized into feature, UI, data access, and utility libraries, each with specific import rules to maintain structure.When considering when to create a new library, it's a balance of granularity and performance. Too few libraries can limit Nx's caching capabilities, while too many can introduce complexity. A visual project graph helps manage this balance, allowing developers to see and adjust their project's architecture visually.Nx's plugin ecosystem enhances its functionality, supporting various frameworks and tools. Official plugins for Angular, React, and testing utilities like Jest and Cypress facilitate seamless integration into existing workflows. Community plugins extend support to additional tools, offering flexibility in project configurations.For projects transitioning from tools like Lerna to Nx, understanding the differences is key. Nx's integrated setup provides more comprehensive support for executors and generators, while a package-based setup offers flexibility in folder structures.Nx also supports CI/CD integration, using the 'Nx Affected' command to optimize test execution, running only tests impacted by code changes. This efficiency is crucial in maintaining quick feedback loops in continuous integration environments.Managing a monorepo effectively involves enforcing module boundaries to prevent undesired dependencies. Nx allows tagging of projects, setting rules for dependencies based on these tags to ensure that projects only depend on allowed libraries, maintaining architectural integrity.Developers can leverage Nx's generators to automate repetitive tasks, minimizing errors and ensuring consistency. By defining custom generators, teams can enforce project-specific standards and streamline the development process, reducing the cognitive load on developers.In essence, Nx provides a comprehensive toolkit for managing complex software architectures. Its features enhance productivity, maintainability, and efficiency, making it an invaluable tool for modern software development.
Understanding React's Fiber Architecture and the Conditional Use of Hooks
Understanding React's Fiber Architecture and the Conditional Use of Hooks
Article
React's Fiber architecture uses a tree structure to manage component states and render processes.Props changes trigger re-renders, even if they appear identical due to reference changes.The fiber tree holds the state history, acting as the source of truth for component re-renders.UseContext can be used conditionally, unlike other hooks, due to its independence from the hook order.Memoization and custom components can optimize rendering and prevent unnecessary updates.React's internal workings revolve around the concept of the fiber architecture, a tree-like structure that keeps track of components and their states. This fiber tree is crucial for rendering processes, as it maintains a history of states and helps determine which components need re-rendering.In JavaScript, even seemingly identical objects can differ if their references are not the same. React uses shallow equality to compare props, which means that even two empty objects are considered different if their references have changed. This leads to re-renders, as the fiber architecture detects these differences.When a component is instantiated, React creates a new fiber. This fiber holds critical information about the component, such as its type, props, and position in the tree. The fiber tree is built as React goes through the code, adding nodes for each instantiated component.The source of truth for determining which components to render is not the code itself, but the fiber tree that React maintains. This tree captures the state and props at any given time, allowing React to efficiently update the DOM by comparing the current fiber tree with the previous one.React's hooks, such as useState and useEffect, store their data in a linked list structure within the fiber. They rely on the order in which they are called, which is why they cannot be used conditionally. Changing the order would disrupt the linked list, leading to incorrect data retrieval.UseContext is different from other hooks because it reads from a separate context object, independent of the hook order. This allows it to be used conditionally without affecting other hooks. When useContext is called, it accesses the context value directly from the context object, bypassing the linked list dependency.Optimizing rendering involves minimizing unnecessary updates. One way to achieve this is by memoizing components. Memoization prevents re-renders if the component's props have not changed. By wrapping a component with React.memo, developers can ensure that it only re-renders when its inputs change.Another optimization technique involves extracting providers into custom components and passing the rest of the tree as children. This method stops the propagation of renders, ensuring that intermediate components do not unnecessarily update when context values change.Understanding how React manages state and rendering through its fiber architecture can greatly enhance the performance and efficiency of applications. By leveraging memoization and custom components, developers can prevent unnecessary re-renders and optimize their React applications.React's fiber tree not only manages state and props but also plays a crucial role in rendering processes. The fiber architecture allows React to efficiently update only the components that need re-rendering, minimizing DOM updates and improving performance.While the fiber architecture provides a robust solution for managing state and rendering, developers must be mindful of how hooks are used. The order of hooks is vital for maintaining the integrity of the linked list, and conditional usage of hooks like useState and useEffect can lead to errors.By understanding the intricacies of the fiber architecture and the conditional use of hooks like useContext, developers can create more efficient and performant React applications. This knowledge empowers developers to optimize rendering processes and prevent unnecessary updates, ultimately leading to a smoother user experience.
Effective State Management in React: Key Lessons and Strategies
Effective State Management in React: Key Lessons and Strategies
Article
Importance of deriving state instead of syncing it with useEffect.Unifying related state into a single object for simplicity and efficiency.Using abstractions like React Query for data fetching instead of useEffect.Leveraging URL for state that should be shareable or bookmarkable.Consideration of UseReducer for managing complex state logic.State management in React is an essential skill for any developer. One common mistake is the unnecessary syncing of state using useEffect, which often indicates a misunderstanding of state derivation. Deriving state from existing state can simplify logic and reduce redundant state declarations. For example, instead of using useEffect to combine firstName and lastName into a fullName state, calculate fullName directly from firstName and lastName. This approach reduces unnecessary state and logic complexity.Managing related state efficiently is crucial. Often, developers separate related properties into multiple pieces of state, leading to complex code. Instead, group related state into a single object. For example, when dealing with address information, combine street, city, and country into one address object. This approach simplifies data initialization and updating, especially when interacting with APIs.Fetching data in useEffect is a traditional method, but with the rise of hooks, better abstractions are available. Libraries like React Query and SWR offer advanced features, such as caching, refetching, and error handling, which useEffect lacks. These libraries simplify data fetching logic and reduce boilerplate code, making applications more robust and maintainable.The URL is a powerful tool for managing shareable state. If a piece of state should be reflected in the URL, like a selected tab or filter, it should be managed there. This ensures consistency across different sessions and enables easy sharing and bookmarking of application states.UseReducer is often underutilized but offers significant advantages for managing complex state logic. It provides a way to centralize state updates, reducing the need for multiple setState calls. UseReducer allows for logic encapsulation and validation before state changes, enhancing code quality and maintainability.These strategies, when applied, can greatly enhance the efficiency and reliability of React applications. By focusing on deriving state, unifying related state, leveraging advanced data fetching libraries, utilizing the URL for shareable state, and employing UseReducer for complex state logic, developers can create more maintainable and efficient applications.
Evaluating React: A Balanced Perspective for 2023
Evaluating React: A Balanced Perspective for 2023
Article
Evaluation Criteria for Choosing React in 2023 Familiarity and Onboarding Benefits Rich Ecosystem and Community Support Performance Considerations and Alternatives Importance of Contextual Decision Making As React celebrates its 10th anniversary, many developers are revisiting the question: is React still the right choice for their projects in 2023? Despite some internet discourse suggesting otherwise, React has maintained a strong presence in the development community, largely due to its flexibility and wide range of applications. But, the decision to use React should not be made lightly or simply based on its popularity. Different projects have different needs, and it's crucial to evaluate React based on specific criteria that match those needs. Familiarity with React is a significant factor for many developers. Being well-versed in a framework like React can lead to faster development times and more efficient problem-solving. This familiarity extends beyond individual developers to entire teams. In large companies, where onboarding new engineers quickly is crucial, the widespread familiarity with React can make it an attractive option. It reduces the learning curve and enables engineers to contribute effectively within days. The ecosystem surrounding React is another compelling reason why it continues to be a popular choice. With a massive community, most React problems have already been addressed, and solutions are readily available online. The documentation is extensive and frequently updated, providing a reliable resource for developers. Additionally, React's ecosystem includes numerous educational resources, such as tutorials, blog posts, and courses, that support continuous learning. Frameworks like Next.js and Remix enhance React's capabilities, offering features like server-side rendering and automatic code-splitting, which improve performance and user experience. React's compatibility with these frameworks further enriches its utility. The availability of open-source tools and third-party integrations, such as Storybook, MUI, and Apollo Client, provides developers with a vast array of options to extend React's functionality. Performance remains a key consideration for developers when choosing a framework. While some newer frameworks may outperform React in specific metrics, React's performance is generally sufficient for most applications. The introduction of features like React Suspense and React Server Components allows for more nuanced performance optimization. For projects with extreme performance requirements, developers can integrate more performance-oriented libraries alongside React. React Native offers additional benefits, particularly for companies looking to share code between web and mobile applications. It enables developers to leverage their React knowledge across different platforms, streamlining development processes and reducing the need for separate teams for web and mobile development. Despite these advantages, it's important to acknowledge that React is not the only option. Developers should consider other frameworks like Vue, Svelte, or Solid, especially if their teams are more familiar with these technologies. The choice of framework should be based on a careful consideration of trade-offs, including community support, performance, and existing team expertise. Real-world examples highlight the importance of context in making these decisions. For instance, a company like Netflix faced unique constraints with its TV application, which led to experiments with Svelte. This decision was driven by specific performance requirements and the need to optimize memory usage. Such examples underscore the value of data-driven decision-making and thorough evaluation of alternatives. Ultimately, the best framework choice depends on the specific needs and priorities of your project or company. It's essential to focus on what you're building, rather than getting distracted by the latest trends. While React may be a great choice for many, it's not the only choice. It's crucial to evaluate the pros and cons of each option and make an informed decision based on your unique requirements.
Enhancing Web Performance: Practical Fixes and Insights
Enhancing Web Performance: Practical Fixes and Insights
Article
Lazy loading optimizes iframe-heavy web pages.Barrel exports can hinder tree shaking.Caching can enhance performance by reducing repeated computations.Unused code detection is crucial for improving build times and readability.Regular performance auditing helps identify optimization opportunities.Optimizing web performance is crucial for user experience and efficiency. High-performance web applications not only improve user satisfaction but also contribute to better conversion rates. One common issue in web performance is the excessive use of iframes, which can slow down page loading times significantly.Lazy loading is an effective strategy to deal with this problem. By initially loading only a few iframes and progressively loading more as needed, the initial load time is reduced. This approach ensures that users interact with the content faster, while the rest of the iframes load in the background.Another common issue is the use of barrel exports, which can interfere with tree shaking. Tree shaking is a method used to remove unused code from the final build, and barrel exports can prevent this from happening effectively. By importing files directly rather than through a barrel, developers can ensure that only the necessary code is included in the final build.Caching is another technique to improve performance, especially for functions that perform heavy computations. By storing results of expensive operations, subsequent calls can retrieve the result from the cache rather than recalculating it. This can significantly reduce the time spent in repetitive tasks, leading to faster performance.Unused code can clutter the codebase and slow down build processes. Tools like Knip can help identify and remove unused code, ensuring that only necessary files are included in the build. This not only speeds up build times but also makes the codebase easier to navigate and understand.Regular performance auditing is essential for maintaining optimal performance. By analyzing performance metrics and identifying bottlenecks, developers can make informed decisions on where to focus their optimization efforts. Using tools like Webpack Bundle Analyzer can help in visualizing the size and structure of the application, making it easier to spot inefficiencies.Incorporating these strategies into the development process can lead to significant improvements in web application performance. By focusing on lazy loading, avoiding unnecessary imports, caching computations, removing unused code, and regularly auditing performance, developers can create faster and more efficient applications. These practices not only benefit the end-users but also enhance the development workflow, allowing teams to build high-quality web applications more effectively.
Navigating Software Development with RedwoodJS: A Full-Stack Journey
Navigating Software Development with RedwoodJS: A Full-Stack Journey
Article
Using RedwoodJS to streamline development with a full-stack React framework. Leveraging GraphQL for efficient data management and querying. Integrating Storybook for isolated component development and testing. Understanding database relationships and migrations with Prisma. Implementing client and server components in React for optimized performance. RedwoodJS offers a unique approach to developing full-stack applications by combining the power of React with a well-structured framework. This integration allows developers to seamlessly build both the frontend and backend of applications, reducing the complexity often associated with managing multiple technologies. One of the standout features of RedwoodJS is its use of GraphQL. This technology enables developers to efficiently manage and query data by defining the precise structure of the data they need. Unlike traditional REST APIs, GraphQL allows for more flexible and efficient data retrieval, which is particularly beneficial when dealing with complex data structures. GraphQL's flexibility shines in its ability to handle both queries and mutations. Queries are used to retrieve data, while mutations allow developers to modify data. This dual capability makes it easier to maintain a consistent data flow throughout the application. Additionally, RedwoodJS simplifies the setup of GraphQL by automatically generating the necessary types and resolvers, which significantly reduces the amount of boilerplate code developers need to write. Another advantage of RedwoodJS is its seamless integration with Storybook. Storybook is an indispensable tool for frontend developers, allowing them to build, test, and showcase components in isolation. This approach not only speeds up development but also ensures that components are thoroughly tested before being integrated into the main application. Incorporating Storybook into the development process provides several benefits. It offers a visual representation of components, making it easier to identify and fix bugs. Storybook also supports testing for accessibility and responsiveness, ensuring that components are usable by a wide range of users and devices. RedwoodJS's approach to database management is facilitated through Prisma, an ORM that simplifies database interactions by providing a programmatic API. With Prisma, developers can define their database schema using a simple syntax, which Prisma then translates into the necessary SQL commands to manage the database. Prisma's schema definition language allows developers to establish complex relationships between different data models. This capability is crucial for applications that require intricate data dependencies, such as user profiles, comments, or nested resources. Once the schema is defined, Prisma handles the heavy lifting of creating and managing database tables, allowing developers to focus on building application features. One of the key tasks in database management is handling migrations, which are changes to the database schema over time. Prisma's migration capabilities ensure that database changes are tracked and applied consistently across different environments. This feature is particularly useful in team settings, where multiple developers might be working on different parts of the application simultaneously. RedwoodJS is positioned to take advantage of emerging trends in React development, particularly with the advent of React Server Components. Server components allow developers to offload some of the rendering work to the server, which can improve application performance by reducing the amount of JavaScript that needs to be executed in the browser. In practical terms, this means that certain components can be rendered on the server and sent to the client as HTML, reducing the load on the client's browser. This is especially beneficial for applications with complex rendering requirements or those that need to maintain high performance across a variety of devices and network conditions. React Server Components complement RedwoodJS's existing capabilities by providing more options for optimizing application performance. Developers can choose whether a component should be rendered on the server or the client based on the specific needs of their application. RedwoodJS's comprehensive approach to full-stack development, coupled with its integration of modern technologies like GraphQL, Prisma, and React Server Components, makes it a powerful tool for building scalable and maintainable applications. By streamlining both frontend and backend development processes, RedwoodJS empowers developers to create robust applications with greater efficiency and reliability.
Mastering React Performance: A Comprehensive Guide
Mastering React Performance: A Comprehensive Guide
Article
Profiling React applications with Chrome DevTools and React Profiler Identifying performance bottlenecks in React applications Techniques for reducing unnecessary re-renders Optimizing component rendering and effect execution Utilizing tools like "Why Did You Render" and "Console Time" for in-depth analysis React applications often face performance challenges that can hinder user experience. It is essential to adopt effective strategies to diagnose and resolve these issues. This guide delves into the intricacies of identifying and addressing performance bottlenecks in React applications. The first step in tackling React performance issues is to use Chrome DevTools and the React Profiler. These tools provide insights into how an application behaves during slow interactions. By recording and analyzing the performance pane, developers can identify when the main thread is blocked and what operations contribute to these delays. When dealing with a slow application, it's crucial to pinpoint what is causing the bottleneck. Developers should look at the CPU row to see periods of high activity. This often correlates with render cycles or effect executions within React. By zooming into these spikes, one can uncover the specific operations that are consuming time. A common issue in React applications is unnecessary re-renders. These occur when components re-render without a change in their underlying data or state. By inspecting components through the React Profiler, developers can see which components render frequently and identify potential inefficiencies. To minimize unnecessary renders, developers can use techniques like memoization. Wrapping components with React.memo and functions with useCallback can prevent them from re-rendering unless their inputs change. However, it's important to note that overusing these techniques can introduce overhead, so they should be applied judiciously. Another layer of performance optimization involves understanding why components render in the first place. The React Profiler provides a setting to record why each component rendered, offering insights into props or state changes that trigger renders. Aside from renders, effect execution can also impact performance. Effects are side-effects triggered by component lifecycles, and they can be costly if not managed properly. Developers should scrutinize the time spent in commit phases of effects and seek to optimize or defer these operations when possible. Tools like "Why Did You Render" can be invaluable in diagnosing performance issues. This tool tracks unnecessary component renders and logs them in the console, providing developers with a clear picture of what changes prompted a re-render. The Console Time API is another powerful resource for developers. It allows for manual timing of code execution, enabling developers to measure and log the duration of specific code blocks. This helps in identifying which parts of a component's lifecycle are the most time-consuming. When optimizing a complex application, it's beneficial to annotate performance traces. By taking screenshots and marking areas of interest, developers can create a visual map of performance hotspots. This practice aids in focusing optimization efforts on the most critical areas. In summary, mastering React performance involves a combination of profiling, analyzing, and optimizing. By utilizing Chrome DevTools, React Profiler, and other tools like "Why Did You Render" and "Console Time," developers can enhance the efficiency and responsiveness of their applications. Through careful analysis and targeted optimizations, it's possible to significantly improve the user experience in React applications.
Mastering React Query: Effective Strategies for Managing Async State
Mastering React Query: Effective Strategies for Managing Async State
Article
Understanding React Query as a State ManagerDistinguishing Between Data Fetching and State ManagementUtilizing Stale Time for Efficient Data SynchronizationLeveraging Query Keys for Parameter DependenciesCombining React Query with Client-State ManagementMany developers encounter situations where a small tweak can make a significant impact, much like tying your shoes correctly. This analogy is particularly relevant in the context of working with React Query. At first glance, it might seem like a data fetching library, but a deeper understanding reveals that React Query is fundamentally an async state manager.React Query does not handle data fetching directly. Instead, it relies on external libraries like Axios or Fetch to perform the actual data retrieval. React Query's role is to manage the promises returned by these libraries, focusing on the state of data: whether it's loading, error-prone, or successfully fetched. This distinction helps clarify common misconceptions about React Query's functionality, emphasizing that its primary concern is managing state rather than fetching data.One of the core principles of React Query is its ability to efficiently manage async state. Traditional state management often involves slicing state based on its usage location, whether it's local, lifted, or global. However, React Query introduces a shift in thinking by distinguishing between synchronous and asynchronous state. Async state, or server state, represents data that is not owned by the client and can become outdated. React Query addresses this by keeping state up-to-date, managing loading and error states, and offering lifecycle management for async data.Understanding the fundamentals of state management is crucial for using React Query effectively. State managers aim to make state available throughout an application with minimal updates. In React Query, this is achieved through the use of query keys, which define the specific parts of state to which components subscribe. By using query keys and selectors, developers can ensure that components only update when relevant data changes, reducing unnecessary renders and enhancing performance.Stale time is a critical concept within React Query, functioning as a data synchronization tool. It determines how long data remains fresh before being considered stale and re-fetchable. By default, stale time is set to zero milliseconds, meaning data is instantly stale and subject to frequent re-fetching. Developers can adjust stale time based on their application's needs, balancing between minimizing network requests and ensuring data freshness.Managing async state effectively also involves treating parameters as dependencies. When parameters, such as filters, are used in query functions, they should be included in the query key. This practice ensures that data is cached properly, avoiding race conditions and enabling automatic re-fetching when parameters change. React Query offers an ESLint plugin to help enforce this practice, promoting consistent and error-free code.Despite React Query's capabilities, there are situations where client-state management remains necessary. For example, filters that dictate query parameters might be managed with local or global state solutions. This separation of concerns allows React Query to manage server state while client state is handled by other means, such as state managers like Zustand or even the URL as a state manager.This approach highlights the power of composition when using custom hooks. By separating service state managed by React Query from client state, developers can create robust applications that leverage the strengths of both state management techniques. Updates to client state, such as filter changes, automatically trigger React Query to fetch the latest data or read from the cache, ensuring a seamless user experience.By mastering these techniques, developers can unlock the full potential of React Query as a true async state manager. This involves understanding its role, utilizing stale time effectively, leveraging query keys for parameter dependencies, and integrating it with client-state management solutions. These strategies empower developers to build applications that are both efficient and responsive, making the most of React Query's capabilities.
Mastering React Suspense: Enhancing Loading Experiences with Apollo Client
Mastering React Suspense: Enhancing Loading Experiences with Apollo Client
Article
Testing Components with SuspenseImpact of Single Suspense Boundaries on PerformanceTransitioning from UseQuery to UseSuspenseQueryManaging Loading States with Suspense BoundariesIntegrating Suspense with React 18 TransitionsReact Suspense allows developers to manage loading states more effectively, providing a smoother user experience. To test components using Suspense, one can utilize popular React testing libraries. These tools simulate user interactions and verify if components render the appropriate loading states. This approach treats the application as a black box, ensuring the user experience is consistent.When testing a component using Suspense, the same principles apply as when testing any loading state. The focus should be on verifying that the component displays the correct fallback UI, such as a spinner or loading message, during data fetching. By using tools like the React Testing Library, developers can write tests that mimic how users interact with the application, ensuring that the component behaves as expected when data is not yet available.Using a single Suspense boundary at the top level of an application can impact performance metrics like Start Content Paint (SCP) and Largest Contentful Paint (LCP). Having one boundary means the entire application waits for all network requests to resolve before rendering anything. This approach can lead to longer loading times, especially if there are numerous data requests.To mitigate performance issues, it's beneficial to use multiple Suspense boundaries. This setup allows different parts of the application to load independently, improving perceived performance. Developers can strategically place these boundaries to balance the user experience and loading times, making the application feel more responsive.Switching from UseQuery to UseSuspenseQuery involves a few changes. The latter integrates with React 18's Suspense features, removing the need for manual loading state management. Instead, Suspense handles these states, allowing components to render once data is available.The transition involves replacing UseQuery with UseSuspenseQuery and adjusting the component structure. Developers no longer need to manage loading booleans or display fallback UI within the component. Suspense handles these automatically, simplifying the code and making it easier to manage data fetching states.Managing loading states effectively requires careful organization of Suspense boundaries. Placing these boundaries around specific components or sections of the application can enhance the user experience. For example, wrapping the entire application in a single Suspense boundary ensures all data is ready before rendering, creating a seamless transition.However, this approach might not be ideal for interactive applications where different sections update independently. In such cases, using granular Suspense boundaries for individual components or groups can provide a more dynamic loading experience.React 18 introduces transitions, which can be combined with Suspense for efficient data fetching. Transitions allow developers to mark specific updates as non-urgent, preventing the UI from displaying loading fallbacks during minor state changes.When implementing transitions with Suspense, developers can wrap data-fetching operations in a startTransition call. This method tells React to keep the existing UI visible while fetching new data, enhancing the user experience by reducing visual disruptions.By leveraging Suspense and transitions, developers can create applications that feel faster and more responsive. These tools provide greater control over loading states and transitions, allowing for a more polished and user-friendly experience.React Suspense and Apollo Client provide powerful tools for managing loading states and improving user experience. By utilizing Suspense boundaries and transitions, developers can create applications that load more efficiently and provide smoother interactions.Using multiple Suspense boundaries allows for better performance management, enabling different parts of the application to load independently. This approach enhances perceived performance, making applications feel faster and more responsive.Integrating Suspense with React 18 transitions further refines the user experience by minimizing visual disruptions during data fetching. By marking updates as transitions, developers can keep the existing UI visible until new data is ready.Overall, mastering React Suspense and Apollo Client's features can significantly enhance the performance and user experience of web applications. By thoughtfully implementing these tools, developers can create applications that deliver fast, seamless interactions and maintain user engagement.
The Art of Ignoring Best Practices for React Performance
React Summit 2024React Summit 2024
19 min
The Art of Ignoring Best Practices for React Performance
This Talk introduces the concept of being a 'React bad boy' by ignoring best practices and optimizing React rendering. It explains how to avoid unnecessary rerenders using React.memo and React DevTools. It also covers advanced techniques like isolating state changes and lazy loading hooks. The Talk explores reducing component rerenders using Svelte stores and optimizing with swap stores in Redux. These techniques improve React performance without the need for major refactors or rewrites.
React in the Autonomous Robotics Industry
React Summit 2024React Summit 2024
11 min
React in the Autonomous Robotics Industry
Hamza Hawi, a software engineer at the Autonomous Robotics Research Center, discusses the use of React and Leaflet in robotics. The research center utilizes a mixed fleet of robots and relies on React for mission planning software, while Leaflet is used for mapping and custom layers. Leaflet offers flexibility for different types of vehicles and supports the creation of custom layers like image and video overlays. Additionally, the talk mentions the use of video overlays for weather forecasts and optimizing joystick usage with a strategy design pattern.
Perfect Pitch: Unveiling the Mathematical Symphony Behind a Guitar Tuner
React Summit 2024React Summit 2024
22 min
Perfect Pitch: Unveiling the Mathematical Symphony Behind a Guitar Tuner
This Talk provides an overview of an open-source guitar tuner project, covering topics such as pitch detection, web APIs for microphone access, implementation with React and XGS, and data visualization. It explores various pitch detection algorithms, including zero crossing, fast Fourier transform, and autocorrelation. The project utilizes the MediaStream API and Audio API to access user media. The implementation is done with React and Next.js, and includes a utility library for performing pitch estimation and detection. The Talk also discusses future improvements for the project, such as noise cancellation and chord detection.
Building End-to-End Encrypted Apps (Web & React Native)
React Summit 2024React Summit 2024
32 min
Building End-to-End Encrypted Apps (Web & React Native)
This Talk explores the concept and advantages of end-to-end encryption in software development. It discusses the challenges of data encryption and conflict resolution in collaborative apps. The integration of end-to-end encryption with conflict-free replicated data types (CRDTs) is highlighted. The talk also covers simplified document sync, real-time sync and encryption, key management, and authentication. Additionally, it mentions the importance of local-first integration, CRDT frameworks, and data search indices.
The Suspense Quest - Inside React's Magic
React Summit 2024React Summit 2024
30 min
The Suspense Quest - Inside React's Magic
This Talk explores the suspense component in React and its benefits in handling fetched data. It delves into the rendering process of React components and how suspense anticipates requests. The offscreen fiber is introduced as a hidden component that ensures state continuity. The Talk also discusses the usage of suspense for handling concurrent queries and throwing promises, as well as the integration of Redux and the upcoming changes in React 19. Overall, the Talk provides insights into the workings of suspense and its potential applications in software development.
Next.js for React.js Developers
React Day Berlin 2023React Day Berlin 2023
157 min
Next.js for React.js Developers
Top Content
Workshop
Adrian Hajdin
Adrian Hajdin
In this advanced Next.js workshop, we will delve into key concepts and techniques that empower React.js developers to harness the full potential of Next.js. We will explore advanced topics and hands-on practices, equipping you with the skills needed to build high-performance web applications and make informed architectural decisions.
By the end of this workshop, you will be able to:1. Understand the benefits of React Server Components and their role in building interactive, server-rendered React applications.2. Differentiate between Edge and Node.js runtime in Next.js and know when to use each based on your project's requirements.3. Explore advanced Server-Side Rendering (SSR) techniques, including streaming, parallel vs. sequential fetching, and data synchronization.4. Implement caching strategies for enhanced performance and reduced server load in Next.js applications.5. Utilize React Actions to handle complex server mutation.6. Optimize your Next.js applications for SEO, social sharing, and overall performance to improve discoverability and user engagement.
Let's build a TV Spatial Navigation
React Day Berlin 2023React Day Berlin 2023
34 min
Let's build a TV Spatial Navigation
Watch video: Let's build a TV Spatial Navigation
Today's Talk is about building a spatial navigation library for Smart TVs. The speaker shares their experience and challenges in building applications for Smart TVs. They demonstrate the functionality of spatial navigation using React and React Router. The navigation engine class is developed to handle TV control events and navigate through elements. Circular navigation is implemented to make navigation easier for users in TV applications.
Virtual DOM: Back in Block
React Day Berlin 2023React Day Berlin 2023
9 min
Virtual DOM: Back in Block
Watch video: Virtual DOM: Back in Block
Hi, my name is Anand Bai. I'll be talking about virtual DOM and its performance. Rich Harris argued that the virtual DOM is not as efficient as many believe, leading to the emergence of the meme that it's pure overhead. Today, I'm going to introduce something new, a new approach to doing the virtual DOM. MillionJS, a drop-in replacement for React, is significantly faster than Preact and React on benchmarks. The block virtual DOM, introduced by Block DOM, is a potential solution to existing virtual DOM libraries like React.
Hacking an e-Reader to Show My Tea Menu With JSX
React Day Berlin 2023React Day Berlin 2023
7 min
Hacking an e-Reader to Show My Tea Menu With JSX
Watch video: Hacking an e-Reader to Show My Tea Menu With JSX
React can be used to create custom menus for e-readers, and the process involves creating an image and e-book with React and loading them onto the e-reader. Writing an EPUB e-book for e-readers involves converting an SVG file into a PNG image and writing the e-book in EPUB format using HTML, CSS, and images. EPUB generators like Pandoc and Dino simplify the process of generating EPUBs from markdown and running JavaScript on the desktop, respectively.
The Gateway to Backend: A Frontend Developer's Guide to Full-Stack Development
React Summit US 2023React Summit US 2023
160 min
The Gateway to Backend: A Frontend Developer's Guide to Full-Stack Development
Top Content
WorkshopFree
Amy Dutton
Amy Dutton
This workshop will guide you through the product development life cycle of creating a real-world web application. You will learn about React Server Components, building a design system within Storybook, and using frontend development to approach becoming a full-stack developer. The workshop will cover increasing confidence in your application with unit tests and implementing authentication and authorization. You'll have the opportunity to work through product features and examine a real-world RedwoodJS project, gaining valuable experience in real-world product development. RedwoodJS makes it simple to approach full-stack development, and this workshop will give you the skills you need to create your own real-world web applications.
Wait, You're Shipping React Native to the Web?!
React Summit US 2023React Summit US 2023
32 min
Wait, You're Shipping React Native to the Web?!
Watch video: Wait, You're Shipping React Native to the Web?!
Guild is a platform that needs to exist on all platforms, using React Native to orchestrate them. React Native and Expo provide components that work across platforms. Building applications with React Native involves composing components and using a design system. Choosing the right server-side rendering solution is important for unifying mobile and web codebases. Embedding React Native allows for optimization and embedding in any application. Bridging the gap between UI and API with embeddable experiences is key to supporting communities on every platform.
React State Management with Valtio
React Summit US 2023React Summit US 2023
10 min
React State Management with Valtio
Watch video: React State Management with Valtio
This is a short presentation on VALTEO, a proxy-based state management system that uses JavaScript's native idea of proxies to create observable and immutable state. The proxy tracks changes to the object and nested proxy objects, only re-rendering the component when a specific key changes. There is a gotcha with proxies in Valtio - avoid reassigning the proxy to a whole new object. Valtio integrates with Redux DevTools, making it even more powerful and convenient.
React Server Components from Scratch
React Summit US 2023React Summit US 2023
29 min
React Server Components from Scratch
Watch video: React Server Components from Scratch
This Talk introduces React Server Components and provides a step-by-step guide on building and rendering them. It explores the capabilities of server components, including interactivity and streaming. The Talk also covers the process of incorporating client-side rendering and the challenges of bundling and mapping client components. Additionally, it discusses the importance of supporting React Server Components and the ongoing efforts to integrate them with different bundlers.
From Todo App to B2B SaaS with Next.js and Clerk
React Summit US 2023React Summit US 2023
153 min
From Todo App to B2B SaaS with Next.js and Clerk
WorkshopFree
Dev Agrawal
Dev Agrawal
If you’re like me, you probably have a million side-project ideas, some that could even make you money as a micro SaaS, or could turn out to be the next billion dollar startup. But how do you know which ones? How do you go from an idea into a functioning product that can be put into the hands of paying customers without quitting your job and sinking all of your time and investment into it? How can your solo side-projects compete with applications built by enormous teams and large enterprise companies?
Building rich SaaS products comes with technical challenges like infrastructure, scaling, availability, security, and complicated subsystems like auth and payments. This is why it’s often the already established tech giants who can reasonably build and operate products like that. However, a new generation of devtools are enabling us developers to easily build complete solutions that take advantage of the best cloud infrastructure available, and offer an experience that allows you to rapidly iterate on your ideas for a low cost of $0. They take all the technical challenges of building and operating software products away from you so that you only have to spend your time building the features that your users want, giving you a reasonable chance to compete against the market by staying incredibly agile and responsive to the needs of users.
In this 3 hour workshop you will start with a simple task management application built with React and Next.js and turn it into a scalable and fully functioning SaaS product by integrating a scalable database (PlanetScale), multi-tenant authentication (Clerk), and subscription based payments (Stripe). You will also learn how the principles of agile software development and domain driven design can help you build products quickly and cost-efficiently, and compete with existing solutions.
Monitoring 101 for React Developers
React Summit US 2023React Summit US 2023
107 min
Monitoring 101 for React Developers
Top Content
WorkshopFree
Lazar Nikolov
Sarah Guthals
2 authors
If finding errors in your frontend project is like searching for a needle in a code haystack, then Sentry error monitoring can be your metal detector. Learn the basics of error monitoring with Sentry. Whether you are running a React, Angular, Vue, or just “vanilla” JavaScript, see how Sentry can help you find the who, what, when and where behind errors in your frontend project. 
Workshop level: Intermediate
Hacking an e-Reader with React
React Advanced Conference 2023React Advanced Conference 2023
7 min
Hacking an e-Reader with React
Watch video: Hacking an e-Reader with React
React for eBooks? Learn how to hack an eReader to display a tea menu. Create images and write e-books using React. Use EPUB format to create chapters and include CSS. Use Pandoc and Dino to simplify the process and make quick updates.
How to NOT use useEffect?
React Advanced Conference 2023React Advanced Conference 2023
24 min
How to NOT use useEffect?
Top Content
Watch video: How to NOT use useEffect?
Welcome to how not to use UseEffect. UseEffect is a hook introduced in React 16.8 as a replacement for component dismount and update in class components. It runs your callback once when the component mounts and when there are changes in dependencies. UseEffect allows performing side effects such as fetching data. UseEffect executes its callback asynchronously to allow the browser to render and show something to the user without blocking the main thread. Setting a state in a useEffect without a dependency array can cause nasty loops. Sometimes you are using use effects to take care of calling parent events. Nasty Fetch. Sometimes, when fetching articles, loading and race conditions need to be considered.
Concurrent React Made Easy
React Advanced Conference 2023React Advanced Conference 2023
23 min
Concurrent React Made Easy
Watch video: Concurrent React Made Easy
Today's Talk introduces concurrent React and highlights the importance of fast and slow updates in user interfaces. It explains how concurrent rendering improves UI performance by allowing fast updates to proceed without being blocked by slow updates. The concept of assigning priorities to renders is discussed, with high priority renders being synchronous and low priority renders being interruptible. The Talk also mentions the benefits of using concurrent features in navigation and list filtering. Overall, concurrent React enhances rendering with interruptibility and prioritization, making the application feel faster and more responsive.
Zod === TypeScript, but at Runtime in Your React Applications
React Advanced Conference 2023React Advanced Conference 2023
20 min
Zod === TypeScript, but at Runtime in Your React Applications
Watch video: Zod === TypeScript, but at Runtime in Your React Applications
Zotter is a powerful tool for working with TypeScript in React applications, providing a simple schema concept for validation. It allows you to convert Zod schemas into TypeScript types and check if objects match the schema. Zod can be used for validation and contract enforcement, ensuring data consistency and preventing issues. It can also be used in React applications to create a validation layer and prevent code from running with incorrect data. The speaker encourages questions and provides contact information for further discussion.
Why Everybody Needs a Framework
React Advanced Conference 2023React Advanced Conference 2023
39 min
Why Everybody Needs a Framework
Watch video: Why Everybody Needs a Framework
Today's Talk explores the value of using frameworks in software development, specifically focusing on React and its impact on web development. The Talk delves into the benefits of frameworks, such as solving routing and data fetching challenges, handling edge cases, and providing server-side rendering. It also introduces the concept of server components and their role in server-side rendering. The Talk highlights the advantages of soft navigation and the seamless communication between client and server. Overall, frameworks offer valuable functionality that enhances productivity and addresses common development challenges.
Hydration, Islands, Streaming, Resumability… Oh My!
React Advanced Conference 2023React Advanced Conference 2023
26 min
Hydration, Islands, Streaming, Resumability… Oh My!
Watch video: Hydration, Islands, Streaming, Resumability… Oh My!
Today's Talk introduces the concepts of hydration and off islands, explores the benefits of islands for enhancing server-side rendered HTML with client-side JavaScript, discusses the lazy approach of re-zoomability and its advantages over traditional hydration, highlights the use of resumability and concurrent React for improved rendering performance, examines the features and concerns of React server components, touches on the co-location of client and server code, and explores future trends in rendering and navigation. The Talk also reflects on past ideas and emphasizes the importance of identifying core metrics for performance optimization.
The State of The State In The App Router
React Advanced Conference 2023React Advanced Conference 2023
32 min
The State of The State In The App Router
Watch video: The State of The State In The App Router
React has improved state management with built-in hooks like useState, useReducer, and useRef. Redux can still be used but it's recommended to avoid global state. Zustand is an alternative state manager that allows for easy creation of hooks. Proper architecture is important for accessing the global store. State managers can add extra bytes to the client's JavaScript bundle, so it's important to be selective in choosing libraries. Next.js and React routers are recommended for server-side rendering and personalized experiences can be achieved with spas.
Patterns for Performance
React Advanced Conference 2023React Advanced Conference 2023
28 min
Patterns for Performance
Watch video: Patterns for Performance
This Talk discusses patterns for performance in React development, including addressing slow resizing in custom cell renderers. It explores optimizing React render performance by reducing excessive re-rendering and using direct style updates. The use of layout effect and callback refs is also highlighted as techniques to improve performance. Additionally, the Talk mentions the AG Grid and TanStack Table libraries, as well as upcoming features like grid state restoration.
How to Use Suspense and GraphQL with Apollo to Build Great User Experiences
React Advanced Conference 2023React Advanced Conference 2023
29 min
How to Use Suspense and GraphQL with Apollo to Build Great User Experiences
Top Content
Watch video: How to Use Suspense and GraphQL with Apollo to Build Great User Experiences
Jerel Miller
Alessia Bellisario
2 authors
This Talk discusses using suspense and GraphQL with Apollo client to build great end user experiences. It explains the core concepts of React suspense and how to fetch data in suspense with Apollo client's new suspense hooks. The Talk also covers optimizing the loading experience by adding suspense boundaries, using the defer directive in GraphQL, and integrating suspense hooks with React 18 transitions. Future plans include new APIs like suspenseful use fragment and lazy use background query in Apollo client 3.9. Testing strategies for suspense in components and customizing loading states are also mentioned.
Practice TypeScript Techniques Building React Server Components App
TypeScript Congress 2023TypeScript Congress 2023
131 min
Practice TypeScript Techniques Building React Server Components App
Workshop
Maurice de Beijer
Maurice de Beijer
In this hands-on workshop, Maurice will personally guide you through a series of exercises designed to empower you with a deep understanding of React Server Components and the power of TypeScript. Discover how to optimize your applications, improve performance, and unlock new possibilities.
 
During the workshop, you will:
- Maximize code maintainability and scalability with advanced TypeScript practices
- Unleash the performance benefits of React Server Components, surpassing traditional approaches
- Turbocharge your TypeScript with the power of Mapped Types
- Make your TypeScript types more secure with Opaque Types
- Explore the power of Template Literal Types when using Mapped Types
 
Maurice will virtually be by your side, offering comprehensive guidance and answering your questions as you navigate each exercise. By the end of the workshop, you'll have mastered React Server Components, armed with a newfound arsenal of TypeScript knowledge to supercharge your React applications.
 
Don't miss this opportunity to elevate your React expertise to new heights. Join our workshop and unlock the potential of React Server Components with TypeScript. Your apps will thank you.
Game Development with ReactJS, CSS, and React Three Fiber
JS GameDev Summit 2023JS GameDev Summit 2023
22 min
Game Development with ReactJS, CSS, and React Three Fiber
Jorge Rubiano, a Software Engineer from Colombia, shares puzzle, isometric, and board games developed using React.js and CSS. He demonstrates the use of WebGL and 3.js for creating 3D games on the web. ReactiveFiber, a renderer that combines React and 3.js, is showcased in movement-based and color-changing games. The Talk concludes with the development of a bowling game using ReactiveFiber and complex components.
7 TypeScript Patterns You Should Be Using
React Summit 2023React Summit 2023
19 min
7 TypeScript Patterns You Should Be Using
Top Content
Watch video: 7 TypeScript Patterns You Should Be Using
This Talk introduces 7 essential TypeScript patterns for React development, including children, spreading props, either-or, generic components, and context. The speaker demonstrates various implementations and provides examples using a fictional dog grooming salon application. Other interesting ideas include using omit and make required types, creating components with either-or interfaces, and using generics, memorization, and context in React. The speaker also introduces the Recontextual library for context management.
Bringing Controversial Ideas to React
React Summit 2023React Summit 2023
8 min
Bringing Controversial Ideas to React
Watch video: Bringing Controversial Ideas to React
This Talk discusses bringing controversial ideas to React, building a plugin architecture, and using Redux without the Connect method. It explores the implementation of plugins that inject functionality into the UI and the use of MobxStateTree. The Talk also highlights the challenges of connecting everything to Redux and the benefits of implementing custom re-renders for better performance. It emphasizes the importance of exploring new territories and embracing controversial ideas for new perspectives.
useMachineLearning… and Have Fun with It!
React Summit 2023React Summit 2023
9 min
useMachineLearning… and Have Fun with It!
Watch video: useMachineLearning… and Have Fun with It!
Nico, a freelance frontend developer and part of the Google Developer Experts program, provides an introduction to machine learning in the browser. He explains how machine learning differs from traditional algorithms and highlights the use of TensorFlow.js for implementing machine learning in the browser. The talk also covers the use of different backends, such as WebGL, and the conversion of audio into spectrograms for model comparison. Nico mentions the use of overlay for improved detection accuracy and the availability of speech command detection and custom model training with TensorFlow. Overall, the talk emphasizes the benefits of using and training machine learning models directly on the device.
Thinking in React Query
React Summit 2023React Summit 2023
22 min
Thinking in React Query
Top Content
Watch video: Thinking in React Query
React Query is not a data fetching library, but an Asian state manager. It helps keep data up to date and manage agent life cycles efficiently. React Query provides fine-grained subscriptions and allows for adjusting stale time to control data fetching behavior. Defining stale time and managing dependencies are important aspects of working with React Query. Using the URL as a state manager and Zustand for managing filters in React Query can be powerful.
Giving Superpowers to Your React Apps with Machine Learning
React Summit 2023React Summit 2023
11 min
Giving Superpowers to Your React Apps with Machine Learning
Watch video: Giving Superpowers to Your React Apps with Machine Learning
Welcome to my lightning talk at React Summit 2023 where I discuss integrating machine learning capabilities in React apps using JavaScript libraries like TensorFlow.js and ONNX.js. These libraries allow for better privacy, lower cost, and lower latency by leveraging system hardware. Examples include using TensorFlow.js and CocoaSSIST to classify images and Ermine.ai for live audio transcription. React developers can now integrate machine learning without needing extensive knowledge of Python or other frameworks.
Overcoming Performance Limitations in React Components for Low-end Devices
React Summit 2023React Summit 2023
9 min
Overcoming Performance Limitations in React Components for Low-end Devices
Watch video: Overcoming Performance Limitations in React Components for Low-end Devices
This Talk discusses overcoming performance limitations in React components for low-end devices, focusing on app launch time and scrolling performance. The speaker shares techniques for improving app launch and scrolling performance, such as pre-rendering, generating HTML at build time, and using the Virtual List component. The Virtual List component recycles dominoes and uses Translate3D function for improved performance. Delegating scrolling to the browser in NativeMode and supporting scrolling via remote control keys are also mentioned. Overall, the Talk highlights the importance of optimizing performance for low-end devices and provides practical solutions for achieving better performance in React components.
No CRA? What now?
React Summit 2023React Summit 2023
7 min
No CRA? What now?
Watch video: No CRA? What now?
React docs suggest using production-grade frameworks like Remix, Next.js, or Gatsby. But if you want to start with a simple pure React app, you can use Vite or Parcel as generic bundlers. Nx provides facilities to set up a workspace similar to Create React app with modern features. You can modularize and scale your project using Nx libraries. Consider upgrading to a Monorepo structure and adding Next.js or Remix applications. Migration strategies are available for existing React apps.
Supercharging React Apps with WASM
React Summit 2023React Summit 2023
25 min
Supercharging React Apps with WASM
Watch video: Supercharging React Apps with WASM
WebAssembly is a fast, secure, and portable technology that challenges JavaScript's dominance on the web. It allows for the use of legacy code and expands the scope of functions that can be performed on various devices. WebAssembly can be used for image processing and machine learning, and it has potential applications in UI component libraries. Startups are already incorporating WebAssembly into their web applications, and optimization and performance are key advantages of this technology.
Should You Use React in 2023?
React Summit 2023React Summit 2023
31 min
Should You Use React in 2023?
Top Content
Watch video: Should You Use React in 2023?
Tru Narla
Jordan Gensler
2 authors
React is a popular choice, but there are claims that it's dead and should be replaced. React has good out-of-the-box performance and is suitable for most applications. React Native allows code sharing between React and React Native. When considering a migration from React to Svelte, there are trade-offs to consider. React offers a standardized way of working and easy onboarding.
You Can’t Use Hooks Conditionally… or Can You?
React Summit 2023React Summit 2023
28 min
You Can’t Use Hooks Conditionally… or Can You?
Top Content
Watch video: You Can’t Use Hooks Conditionally… or Can You?
The Talk discusses the use of the Use hook in React and its ability to be used conditionally. It explains the concept of the fiber tree and how hooks values are stored in memory. The Talk also delves into the conditional use of useContext and how it differs from useState. It explores the process of updating context values and optimizing context rendering. The role of the provider in managing context values and rendering is emphasized.
From Idea to Production: React Development with a Visual Twist
React Summit 2023React Summit 2023
31 min
From Idea to Production: React Development with a Visual Twist
WorkshopFree
Omer Kenet
Omer Kenet
Join us for a 3-hour workshop that dives into the world of creative React development using Codux. Participants will explore how a visually-driven approach can unlock creativity, streamline workflows, and enhance their development velocity. Dive into the features that make Codux a game-changer for React developers. The session will include hands-on exercises that demonstrate the power of real-time rendering, visual code manipulation, and component isolation all in your source code.
Table of the contents: - Download & Setup: Getting Codux Ready for the Workshop- Project Picker: Cloning and Installing a Demo Project- Introduction to Codux Core Concepts and Its UI- Exercise 1: Finding our Feet- Break- Exercise 2: Making Changes While Staying Effective- Exercise 3: Reusability and Edge Case Validation- Summary, Wrap-Up, and Q&A
0 to Auth in an hour with ReactJS
React Summit 2023React Summit 2023
56 min
0 to Auth in an hour with ReactJS
WorkshopFree
Kevin Gao
Kevin Gao
Passwordless authentication may seem complex, but it is simple to add it to any app using the right tool. There are multiple alternatives that are much better than passwords to identify and authenticate your users - including SSO, SAML, OAuth, Magic Links, One-Time Passwords, and Authenticator Apps.
While addressing security aspects and avoiding common pitfalls, we will enhance a full-stack JS application (Node.js backend + React frontend) to authenticate users with OAuth (social login) and One Time Passwords (email), including:- User authentication - Managing user interactions, returning session / refresh JWTs- Session management and validation - Storing the session securely for subsequent client requests, validating / refreshing sessions- Basic Authorization - extracting and validating claims from the session token JWT and handling authorization in backend flows
At the end of the workshop, we will also touch other approaches of authentication implementation with Descope - using frontend or backend SDKs.
Server Components with Bun
Node Congress 2023Node Congress 2023
7 min
Server Components with Bun
Top Content
Bun is a modern JavaScript runtime environment that combines a bundler, transpiler, package manager, and runtime. It offers faster installation of NPM packages and execution of package.json scripts. Bun introduces a new JavaScript and TypeScript bundler with built-in support for server components, enabling easy RPC with the client. This allows for code splitting and running code that streamingly renders React or any other library from the server and mixes it with client code, resulting in less JavaScript sent to the client.