Sébastien Lorber
Sébastien Lorber

Sébastien Lorber

This Week In React #103: Contentlayer, Remotion 3, Stale Closure, Cross-platform, Jest 28, Hydration, Netlify Edge Functions...

This Week In React #103: Contentlayer, Remotion 3, Stale Closure, Cross-platform, Jest 28, Hydration, Netlify Edge Functions...

Sébastien Lorber's photo
Sébastien Lorber
·Apr 27, 2022·

5 min read

Subscribe to my newsletter and never miss my upcoming articles

Table of contents

  • React
  • React-Native
  • Other

Hi everyone!

Great releases this week: Contentlayer, Remotion 3, Jest 28, Netlify Edge Functions...

A good diversity of React articles, including 2 related to cross-platform, a subject that interests me very much.

🙏 Support the newsletter:

If you like this newsletter, subscribe in priority there:


React

Contentlayer: Content Made Easy for Developers (beta)

Contentlayer is a new system that offers to manage the glue between your content (Markdown, CMS, Notion...) and your code. You define a schema, and it will validate/compile your content and efficiently generate a .contentlayer folder with TypesScript types, and the content ready to be imported directly into your app. This seems to improve build performance significantly (up to x2 even even with cold caches). The beta has an official Next.js integration reduces the amount of glue code. I recommend watching the intro intro video (5min) to understand how it works in a Next.js context. A new project by Johannes Schickling, also creator of Prisma, also working on the glue between code and DB.

Remotion 3.0

Remotion allows you to create videos programmatically, with React (web) code and data/props. After 10 months of development, v3.0 has just been released (trailer) and the main new feature is the new support for serverless rendering on AWS Lambda, which allows you to scale, reduce costs, and produce videos much faster!

Hooks, Dependencies and Stale Closures

Interactive article to help fully understand the stale closure problem in React. If you use memoization and do not respect the ESLint exhaustive-deps rule, you risk introducing this type of problem in your codebase, and it is not always easy to debug!

The challenges of rendering an OpenLayers map in a popup through React

An interesting feedback on rendering a React app in several windows via portals. There are advantages (a single state to control all the windows) but also some challenges to solve.

Extras:

React-Native

Migrating React And Native Apps To React Native

Callstack engineers explain how to adopt React-Native for an existing app, with 2 different approaches: greenfield (full rewrite) and brownfield (incremental migration). Also evokes how to port a web application to React-Native.

Writing cross-platform components for web and React Native

Artem gives some ideas for cross-platform web/mobile development. He suggests using primitive components, and taking a web-first approach for DX reasons: developing in the browser and testing with Cypress, then verifying that the mobile app works.

Extras:

Other

Jest 28: Shedding weight and improving compatibility

Lots of cool things in this release! My highlights:

  • Sharding support to parallelize test execution
  • Full support for package "exports"
  • GitHub Actions Reporter looks very convenient
  • ESM support still blocked
  • jest-runner-tsd: for testing TypeScript types
  • jest-light-runner: 2x faster on Babel codebase

Building a JavaScript Bundler

Christoph Nakazawa explains how to create a JavaScript bundler, based on some existing Jest packages. Reading JavaScript files, creating the dependency graph, the bundle runtime, final bundle assembly... A technical reading that greatly demystifies the internal workings of a simple bundler.

Netlify Edge Functions (beta)

After a failed attempt (Edge Handlers), Netlify releases a new serverless @ Edge offer with its Edge Functions in beta, based on the Deno Deploy infrastructure, and thus more compatible with web standard APIs. This allows in particular to run React meta-frameworks using server-side code more optimally: Remix, Next.js (only middleware for now), Hydrogen, Server Components, Astro...

Hydration is Pure Overhead

The creator of Qwik/Angular continues to question the hydration model of our server-side rendered SPAs, and pushes to adopt another more efficient model, based on "resumability".

Extras:

 
Share this