This Week In React #99: Remix, Next.js, Redux, Memoization, Storybook, Ladle, Wix, Shopify, React-Native, CodeSandbox, Prettier, Deno...
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:
📜 Nexus — a Component Tree Visualizer for Next.js: extension VSCode
📖 Partydown + Gatsby: integration doc
📖 Dan Abramov annonced 3 new doc pages on the beta site: useReducer, useContext, createContext
📦 React-Runner v1: stable release for this modern alternative to React-Live permitting to create a code editor with a live preview. Similar to CodeSandbox Sandpack but without any iframe, running directly in the browser.
📦 React-Spline: to run 3D experiences created with the Spline tool. Not 100% sure what this is, but it looks like a possible alternative to Blender + React-Three-Fiber?
📦 MDX v2.1
💸 Sponsors
💡 How to sponsor this newsletter
React Bricks: CMS with visual editing for Next.js, Gatsby and Remix, based on React components
Content creators don’t like the grey forms of a headless CMS.
Visual tools like Wix or Webflow are either not flexible, complex to use or too flexible: a content creator should not decide on a margin, right?
React Bricks has the best of the 2 worlds: all the advantages of a Headless CMS and best in class Visual editing experience with no way to break the design system.
You create visually editable content blocks as React components using the react-bricks library. Content creators use these blocks to compose content with all the freedom they want and no more than they need.
Learn it in about 2 hours with the Step-by-step tutorial or the full Documentation.
Create your free account and start building now
React-Native
📦 React-Native v0.68.0-rc.3: stable v0.68 planned for next week, including a switch to enable Fabric and the new architecture 🤯
🧑🎨 React-Native-Skia: shadows
🎙️ RNR 229 - Building an Expo App for Mobile and Web with Josh Justice
📦 React-Native-Quick-SQLite: async callbacks support
Partners
Start React Native: learn everything about gestures and animations with William Candillon
React-Native Weekly: stay up-to-date React-Native core updates
TypeScript Weekly: the best TypeScript links every week, right in your inbox.
ES.next News: learn about the latest in JavaScript and cross-platform tools
Tailwind Weekly: all things Tailwind CSS, new issue every Saturday
G2i: pre-vetted remote React & React-Native developers you can trust on contract or full-time basis
Infinite Red: US React-Native experts making your idea a reality
Software Mansion: the co-creators of React Native and the technological core of many tech companies
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:
Prettier 2.6: new
singleAttributePerLine
option, TS 4.6 support...Deno 1.20: significant perf improvements, TS 4.6 support, V8 upgrade...
welcome2web3.com: ironic site, demo the web3 UX 😂
Lamina: "Tailwind for shaders"
Vercel Deploy: Chrome Extension
Protestware is trending in open source: 4 different types and their impact
Packages with high download numbers that nobody wanted to install