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:
- 😘 Recommend it to your friends: it really helps!
- 💸 Sponsor This Week In React
- 😍 Write testimonials on Twitter
- 🧵 Retweet the latest Twitter thread
- 📨 Reply to this email: feedback is welcome
- 👥 Follow on LinkedIn
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 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:
- 📜 File-based routing with React Location --- Nested layouts: the creator of Generouted continues his series on implementing a home-made file-based routing. Here he shows how to implement nested layouts (inspired by Remix) based on Vite and React-Location.
- 📜 React Component Composition Explained: composition can help solve drilling props and improve performance.
- 📜 Upgrading to React 18 with TypeScript: summary of TypeScript breaking changes coming with React 18, and how to automate the migration via codemod.
- 📜 Flexible Design System Components With "as/is" Props: useful technique to use a component with different HTML tags depending on the context:
<span>
,<h1>
... - 📜 Introduction to React v18 Suspense and Render-as-You-Fetch approach: using React 18 new features to avoid waterfalls.
- 📜 Creating a Rich Text Editor using Rust and React
- 📜 Create powerful and flexible forms with React Hook Form
- 📜 Exploring React Suspense with React Freeze
- 💡 Gatsby RFC: GraphQL TypeScript Generation
- 🐦
next/link
will no longer require<a>
as a child: looks like a nice quality of life improvement 😉 - 🐦 React + Qwik
- 🧵 Sebastian Markbåge: "Hydration in React was originally not built for SSR": there's been interesting hydration discussions this week, probably in reaction to this Misko Hevery article (creator of Qwik/Angular)
- 🧵 Alex Russell on CSS-in-JS: fair criticism of runtime-based CSS-in-JS libs
- 📦 Create-React-App Redux Template v2: update React 18
- 📦 Jest-Preview: new solution that integrates with React-Testing-Library to visually see your tests run and debug them more easily.
- 📦 Rive-React: React bindings for the Rive animation platform
- 📦 Jotai-form
- 📦 MDX-to-MD
- 🎥 The Official Beginner's Guide to XState in React
- 🎥 React for the Haters in 100 Seconds
- 🎥 Redux in 100 Seconds
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:
- 📜 Use Storybook with Nx React Native
- 🎙️ React-Native-Radio 232 - Flutter is better than React Native...in all the ways that don't matter
- 🎙️ The React Native Show Podcast: Coffee Talk #1 - React v18.0 & React Native 0.68
- 👥 React-Native EU: Call-For-Papier open until end of Mai
- 📦 React-Native V8 1.0
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
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.
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...
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:
- Marko: Compiling Fine-Grained Reactivity
- Marko for Sites, Solid for Apps
- Progressive Enhancement and HTML Forms: use FormData
- Island Architecture
- V8 - Faster initialization of instances with new class features
- Learn PWA
- Div Riots: Our experience with Astro
- The Future of CSS: CSS Toggles
- TypeScript and Set Theory
- JSDB: Use javascript as your database
- SvelteKit can now run on Vercel Edge Functions
- How to Use Next.js Middleware on Netlify
- Vitest VS Code Extension
- Nx 14.0
- Deno 1.21
- Parcel 2.5
- ESLint 8.14
- Vitest 0.10