This Week In React #121: Next.js, cache, CSS-in-JS, Qwikify, Typesafety, 3D, Vitest Preview, Outstatic, Remix, React-Native...
Tags: react, reactnative
Published: 2022-10-25 16:58:24

---
series: This Week In React
canonical_url: https://thisweekinreact.com/newsletter/121
---

Hi everyone!

It's the conference season: the ViteConf replay is available, React Advanced just finished, and more to come.

The Next.js conference starts in a few hours. We'll probably get a Next.js 13 announcement, along with nested layouts, and some other super cool stuff that starts with Turbo 🤭. Let's discuss that next week.

We also have all the hosts agreeing to improve their Next.js support at the same time: Netlify, Cloudflare, Microsoft...

Don't miss William Candillon's React-Native video season 5 which starts today!

I recorded a [podcast episode about Docusaurus 2.0 with PodRocket](https://podrocket.logrocket.com/docusaurus) last month. Totally forgot to mention it 😅 I want to do more podcast episodes in the future, so please invite me! 😉

**💡 [Check this newsletter on Twitter](https://slo.im/thread) - visual format 🎨**

---

## 💸 Sponsor

[![Sizzy - the browser for developers](https://thisweekinreact.com/emails/issues/220/sizzy.jpg)](https://sizzy.co/?utm_campaign=newsletter&utm_source=thisweekinreact)

How come professionals in every other industry have specialized tools, but web developers are still stuck using the browser that their grandma is using for shopping on Amazon?

If you're opening localhost:3000 in any other browser except Sizzy, you're wasting hours of your precious time.

**Before Sizzy:** web development is stressing you out, responsive design is hard, you have an overwhelming amount of opened tabs and apps.

**After Sizzy:** all the tools you need are in one place, responsive design is a breeze, no more context switching.

You can [download it here](https://sizzy.co/?utm_campaign=newsletter&utm_source=thisweekinreact) and try it for free for 14 days!

---

## ⚛️ React

**[Why We're Breaking Up with CSS-in-JS](https://dev.to/srmagura/why-were-breaking-up-wiht-css-in-js-4g9b)**

Sam is a maintainer of Emotion, one of the most popular CSS-in-JS libs. He explains the advantages and disadvantages of CSS-in-JS, with a focus on runtime libraries problems. For his company Spot, the cost of serializing styles was too high. They replaced Emotion by Sass modules (CSS modules + Sass) with a CSS utility system. On Docusaurus, we use CSS modules and I confirm that it is a good no-runtime and relatively simple alternative. DX is not as good but still quite acceptable.

This article has started many interesting discussions. It has been known for a while that CSS-in-JS libraries with runtime cause performance problems. [Dan Abramov confirms](https://twitter.com/dan_abramov/status/1584835028986793984) and [does not want to use any runtime on the new React doc site](https://github.com/reactjs/reactjs.org/issues/5115). Ryan Florence mentions [performance problems with Chakra](https://twitter.com/ryanflorence/status/1582835729360572416), which uses Emotion.

Tailwind remains a good alternative. For me, it can be put in the CSS-in-JS no-runtime category, especially in a React context where Tailwind styling is done via JSX. Some question its [maintainability](https://twitter.com/hi__mayank/status/1584261503670448128), but in practice it works quite well.

**[Qwik React](https://qwik.builder.io/qwikcity/integrations/react/)**

Qwik is an innovative SPA framework that [avoids performance issues related to client-side hydration](https://www.builder.io/blog/hydration-is-pure-overhead). It can now integrate with React through a `qwikify$()` function to wrap any existing React component. `client:` directives (inspired by Astro) allow to control when the React component will be hydrated with a lot of granularity. The demo integrates Material UI in a Qwik app. See also [this video](https://www.youtube.com/watch?v=fLH28rDu97I). I think it's a good solution to avoid doing an all-in on this new framework, and try it gradually. We can also keep the cross-platform properties of React, while adopting Qwik to improve performance on the web.

**[Fully Typed Web Apps](https://www.epicweb.dev/fully-typed-web-apps)**

Kent C. Dodds explains the interest of having end to end type-safety, from the DB to the UI, through the different boundaries: network, localstorage, DB... He talks about validation (schema, type guards), type generation (Prisma) and conventions (Remix). He explains how this experience is possible with Remix, thanks to inference: it is better to use `typeof` than `as`.

**[Building an interactive WebGL experience in Next.js](https://vercel.com/blog/building-an-interactive-webgl-experience-in-next-js)**

Vercel explains how they created an [impressive immersive signup experience for the Next.js conf](https://nextjs.org/conf), based on React-Three-Fiber. It's still complex to understand without 3D / WebGL / Three.js experience, but the deconstruction in successive steps is interesting and gives an insight into the mindset of doing creative dev.

- 👀 [React Cache API Pull-Request](https://github.com/facebook/react/pull/25506): exposes a new `React.experimental_cache` API
- 📖 [New beta doc - cloneElement](https://twitter.com/dan_abramov/status/1582814754426433537)
- 📦 [Vitest Preview](https://www.vitest-preview.com/): permits to visually debug Vitest tests. Little brother of [Jest Preview](https://www.jest-preview.com/).
- 📦 [Outstatic - A static CMS for Next.js](https://outstatic.com/): new Git-based CMS that integrates nicely with Next.js. Simple user-friendly editor with the ability to upload images.
- 📜 [Netlify - Background and Scheduled API Routes for Next.js](https://www.netlify.com/blog/new-background-scheduled-api-routes-nextjs/): Netlify using its background functions to call Next.js API based on cron expressions.
- 📜 [Cloudflare Pages support for Next.js Edge Runtime](https://blog.cloudflare.com/next-on-pages/): Cloudflare now supports Next.js, only via the `experimental-edge` runtime that can run on Cloudflare Workers (unlike the Node.js runtime). Their solution is based on [Vercel Build Output API](https://vercel.com/blog/build-output-api), which seems to pave the way for better portability of edge-first frameworks between different clouds.
- 📜 [Microsoft - Extending Next.js support in Azure Static Web Apps](https://techcommunity.microsoft.com/t5/apps-on-azure-blog/extending-next-js-support-in-azure-static-web-apps/ba-p/3627975): Azure will now support Next.js SSR (previously: only SSG).
- 📜 [Persist inputs after a form submit in Remix](https://sergiodxa.com/articles/persist-inputs-after-a-form-submit-in-remix): proposes a progressive enhancement solution to keep the values of a form after a submission. 2 solutions: return the values in the Remix action or use the flash session.
- 📜 [Currying Layout Component Patterns in Next.js](https://creativedesignsguru.com/currying-nextjs-layout/): suggest to parametrize the `getLayout` of Next.js to create Layout variants without leading to unmount/remount. Nice trick today, might become less relevant with the upcoming nested layouts support.
- 📜 [Throwing vs. Returning responses in Remix](https://sergiodxa.com/articles/throwing-vs-returning-responses-in-remix)
- 📜 [Lessons learned from moving to Recoil.js](https://kitemaker.co/blog/lessons-learned-from-moving-to-recoil)
- 📜 [Separate API Layers In React Apps](https://profy.dev/article/react-architecture-api-layer)
- 🎥 [Is the new React use hook a footgun?](https://www.youtube.com/watch?v=ytXM05PVcFU)
- 🎥 [React Advanced London 2022 - Day 1](https://www.youtube.com/watch?v=1x7mI_xuVVo)
- 🧵 [Lottie vs Rive](https://twitter.com/guidorosso/status/1582086637328031745): Lottie is quite popular in the React ecosystem but its competitor Rive looks much more performant at runtime.
- 🐦 [Zustand code in a tweet](https://twitter.com/dai_shi/status/1583082766081531905)
- 🔗 [New website for Storybook](https://twitter.com/storybookjs/status/1583175829009289216)

---

## 💸 Sponsor

[![Sunsama - How 1000s of software engineers stay productive without burning out](https://thisweekinreact.com/emails/issues/121/sunsama.jpg)](https://www.sunsama.com/a/this-week-in-react)

**[How 1000s of software engineers stay productive without burning out](https://www.sunsama.com/a/this-week-in-react)**

You know that the output of your work matters more than the number of hours you put in. **[Sunsama](https://www.sunsama.com/a/this-week-in-react)** has been the insider secret of 1000s of developers who use it to work less but achieve more.

Eliminate endless tab-switching with their JIRA, Github, and Notion integration. Timebox your day and create space for your hobbies and side-projects.

The best part? They're offering a **[14-day free trial](https://www.sunsama.com/a/this-week-in-react)** (no card needed) so you can start achieving more, today.

---

## 📱 React-Native

- 🎥 [Headspace Player - “Can it be done in React Native?”](https://www.youtube.com/watch?v=pErnuAx5GjE): season 5 just started today 🤗
- 🤫 [Some rumors going around about Expo SDK 47](https://twitter.com/tsapeta/status/1582831949030522881): a promising SDK!
- 🗣 [The new architecture is here… what now? 3.0](https://twitter.com/Kelset/status/1583416697741975552): React Advanced talk slides from Lorenzo (Microsoft).
- 📈 [React-Native performance brenchmarks](https://twitter.com/almouro/status/1584628478963777537): Alexandre does daily benchmarks and compares the performance of the old VS the new architecture on various scenarios.
- 📖 [Reassure documentation](https://callstack.github.io/reassure/): Reassure has a brand new Docusaurus doc site 🤗
- 📖 [Expo Docs Updates - new Flipper plugin integration guide](https://twitter.com/amanhimself/status/1583202477469765633)
- 📦 [create-react-native-library 0.25](https://twitter.com/satya164/status/1583462129235263490): Kotlin Turbo module template
- 📦 [Expo Router 0.0.31](https://twitter.com/Baconbrix/status/1582875434567409664)
- 📦 [Expo Router 0.0.33](https://twitter.com/Baconbrix/status/1584289284713947136)
- 📦 [Realm JavaScript v11 - Hermes Support, Realm React, Flipper, and Much More](https://www.mongodb.com/developer/products/realm/realm-javascript-v11-react-native/)
- 🎙️ [RNR 249 - A Redux Maintainer’s Thoughts on RTK vs MST](https://reactnativeradio.com/episodes/rnr-249-a-redux-maintainers-thoughts-on-rtk-vs-mst)

---

## 🧑‍💻 Jobs

🧑‍💼 [**Product Engineer at Causal, Remote/London/NY, $150-250k**](https://jobs.lever.co/causal-app/4acaafbe-ef3d-45a6-bbe6-687c022d727c?lever-origin=applied&lever-source%5B%5D=thisweekinreact.com)

Causal is a Series A Startup (backed by Coatue/Accel) building an all-in-one tool for working with numbers and visualizing data. We're looking for strong React engineers who can solve difficult UX/performance challenges.

🧑‍💼 [**G2i - 100% Remote React Native Jobs**](https://twitter.com/gabe_g2i/status/1563204813881425926?s=20&t=ArRLC77BpRwXXCdx8fnUqw)

We have several roles open for developers focused on React Native! Pay is ~160k plus 10% bonus. You must have production experience with RN and be based in the US. DM [@gabe_g2i](https://twitter.com/gabe_g2i) to learn more and don't forget to mention This Week in React.

💡 [How to publish an offer?](https://thisweekinreact.com/sponsor)

---

## 🔀 Other


- [Let’s talk about web components](https://bradfrost.com/blog/post/lets-talk-about-web-components/): Interesting reading by Brad Frost on Web Components, which are not necessarily incompatible with React but can complement it (e.g.: a design system in a React app). The current difficulties (SSR) will eventually be overcome.
- [Replit App](https://twitter.com/amasad/status/1582754714575257600): new app to code on your phone (made with [Expo](https://twitter.com/amasad/status/1582968657675661314)). There are templates to code in Next.js.
- [Introducing Node.js 19](https://www.redhat.com/en/blog/introducing-nodejs-19) - Note: Node.js 18 enters LTS today!
- [Introducing Stately Studio 1.0](https://stately.ai/blog/introducing-stately-studio-10): XState state machine editor
- [Vite 4 plans](https://github.com/vitejs/vite/discussions/10570): upgrade to Rollup 3, es2020 compat...
- [ViteConf 2022 replay](https://viteconf.org/2022/replay)
- [Turborepo 1.6 - Use Turborepo in non-monorepos](https://twitter.com/turborepo/status/1583518617970233346)
- [Solid 1.6](https://twitter.com/solid_js/status/1583016386984480768)
- [Futuristic CSS](https://www.smashingmagazine.com/2022/10/futuristic-css/)
- [Is There Too Much CSS Now?](https://css-tricks.com/is-there-too-much-css-now/)
- [npm bin script confusion: Abusing ‘bin’ to hijack ‘node’ command](https://socket.dev/blog/npm-bin-script-confusion)
- [Tailwind CSS v3.2: Dynamic breakpoints, multi-config, and container queries](https://twitter.com/adamwathan/status/1582793658168152065)
- [Tailwind CSS v3.2: revisiting my “feature creep” warning](https://www.brycewray.com/posts/2022/10/tailwind-css-v3-2-revisiting-feature-creep-warning/)
- [Can I DevTools - Compare the features of browsers DevTools. ](https://canidev.tools)
- [Vercel - Regional Edge Functions](https://vercel.com/blog/regional-execution-for-ultra-low-latency-rendering-at-the-edge)
- [Deno - Which serverless edge platform has the fastest git deployments?](https://deno.com/blog/fastest-git-deploys-to-the-edge)
- [Cloudflare Workers and micro-frontends: made for one another](https://blog.cloudflare.com/better-micro-frontends/)
- [Blink: Intent to Ship: CSS Color Module Level 4 + color-mix()](https://twitter.com/intenttoship/status/1583110354074116096)
- [Release Notes for Safari Technology Preview 156](https://webkit.org/blog/13394/release-notes-for-safari-technology-preview-156/)
- [WebKit Features in Safari 16.1](https://webkit.org/blog/13399/webkit-features-in-safari-16-1/)
- [JavaScript metaprogramming with the 2022-03 decorators API](https://2ality.com/2022/10/javascript-decorators.html)

---

## 🤭 Fun

[![Meme - VSCode running on iWatch](https://thisweekinreact.com/emails/issues/121/meme.png)](https://twitter.com/rohanpdofficial/status/1583455633134977026)