This Week In React #99: Remix, Next.js, Redux, Memoization, Storybook, Ladle, Wix, Shopify, React-Native, CodeSandbox, Prettier, Deno...

This Week In React #99: Remix, Next.js, Redux, Memoization, Storybook, Ladle, Wix, Shopify, React-Native, CodeSandbox, Prettier, Deno...

Hi everyone!

A lot of great articles this week, on Remix or Next.js, or even from great companies like Uber, Wix or Shopify.

I particularly like the article on preemptive memoization, and even planned to write a very similar article 😅.

Ladle is a modern alternative to Storybook, easy to adopt and based on Vite and ESM. It's clearly a trend: see also Vitest modernizing Jest.

React-Native 0.68 is coming next week, with a switch to enable Fabric and the new architecture! 🤯

🙏 Support the newsletter:

If you like this newsletter, subscribe in priority there:

React

Ladle - A drop-in alternative to Storybook

Ladle is a project from an Uber engineer who loves Storybook but still sees various performance issues within his company: build time, startup time, Time-To-Interactive... So he created a much faster alternative , based on Vite and ES modules, and compatible with the Component Story Format to make adoption easy (demo).

Preemptive Memoization In React Is Probably Not Evil

A very interesting and well-documented article on the stability of objects and callbacks. Despite the fact that the use of useMemo may look like a premature optimization, Zhenghao recommends stabilizing identities as much as possible, at least for libs and custom hooks. We look forward to React-Forget and Records & Tuples which could greatly simplify our lives.

Remix Stacks & Remix v1.3

The Remix CLI now allows you to initialize a project with a given stack. Remix offers 3 built-in stacks to get started very fast (DB, auth, host, tests...), and it is possible to create your own stack (for your company projects for example). On the 3 stacks available, the difference is mainly on hosting or persistence, and we find in common base: Tailwind, TypeScript, Prettier, ESLint, Cypress, MSW, Docker, Vitest, Testing Library.

I find it good to provide starters to get started quickly, but I have mixed feelings about the "template" approach, I prefer the "company-scripts" approach (like CRA) that Kent previously advocated for, to reduce the maintenance of existing projects over time.

Upgrading Next.js for instant performance improvements

Vercel recently upgraded a demo app (Virtual Reality Store) from Next.js v8 to v12. Lydia takes the opportunity to list the many improvements that come with the latest versions, and that you get with a minimal upgrade effort. A nice overview of new features that you might have missed.

How Wix Applied Multi-threading to Node.js and Cut Thousands of SSR Pods and Money

Feedback from Wix explaining how they optimized their platform running React Server-Side-Rendering with high CPU demand. They used the new Node.js API 14 worker_threads (allows memory sharing unlike child_process) and got very good results. It's more about Node.js but still find it interesting for those that run self-hosted React SSR pipelines.

Shopify: Creating a React Library for Consistent Data Visualization

Feedback from Shopify reporting consistency issues on its data-visualizations. Solution: the creation of the Polaris Viz lib, that will be open-sourced soon. They explain in particular the use of the React context to create default themes and the possibility of creating variants via partial overrides.

Idiomatic Redux: Designing the Redux Toolkit Listener Middleware

Mark Erikson does a retrospective on the design of the new Redux Toolkit 1.8 Listener Middleware API, which spans over 2 years, with many iterations. They managed to cover many Redux-Saga/Observable use cases with a relatively simple API. I like the concept of await condition(predicate).

Extras:

React-Native

Other

CodeSandbox Projects

CodeSandbox rewrite, new cloud dev experience for projects of any size, with IDE integration (now VSCode, more to come) and even iPad support. Nice contribution workflow, seems handy for quickly collaborating or reviewing a pull-request without switching your local git branch.

Extras:

image

Did you find this article valuable?

Support Sébastien Lorber by becoming a sponsor. Any amount is appreciated!