DEV Community

Cover image for This Week In React #102: Lexical, Mitosis, Remix, Next.js, Redux, Storybook, TurboModules, Node 18, HTTP 103, CSS :has()...
Sebastien Lorber
Sebastien Lorber

Posted on • Edited on

This Week In React #102: Lexical, Mitosis, Remix, Next.js, Redux, Storybook, TurboModules, Node 18, HTTP 103, CSS :has()...

Hi everyone!

Lexical seems to be a modern alternative to Draft.js.

Redux invites us more than ever to adopt Redux Toolkit.

Many libraries provide support or better compatibility with React 18.

React-Native: the adoption of the new architecture is well underway, with several early adopters releasing TurboModule-related libs and content.

The web platform continues to improve, and Node 18 improves its compatibility with standards by adding the fetch() API.

🙏 Support the newsletter:

If you like this newsletter, subscribe in priority there:


React

Lexical

New open-sourced lib by Meta for creating extensible text editors (with a system of plugins to support mentions, hashtags, collaborative editing...). It seems to be a modern, lightweight alternative to Draft.js (no need to use ImmutableJS this time 😏). Doesn't specifically depend on React, but provides an official binding. Can be used by other frameworks and could even target other plateforms (iOS support planned)

A Quick Guide to Mitosis

Mitosis is a tool that allows you to create a design system with a dialect close to React/JSX (inspired by Solid). Mitosis is able to compile these components to various frameworks (React, Angular, Svelte, React-Native...). This can be handy for large companies that use multiple frameworks over time. This official article is a good introduction.

Multiple forms per route in Remix

Explains how to manage 2 forms associated with the same Remix route. It's only possible to have one ActionFunction per route, so the best solution seems to be to use the action attribute on the submit button.

Accessible React Forms

A good overview of some accessibility principles in a React context: description of aria-* props and their impact on screen readers, color, focus ring...

Storybook Lazy Compilation for Webpack

The upcoming Storybook 6.5 will include performance improvements to improve the local DX through lazy compiling stories: 3x faster startup, 2x faster rebuild. The impact seems significant for larger Storybooks. Compare with Ladle, an alternative to Storybook released recently that also tries to improve performances.

Extras:

React-Native

Other

CSS Parent Selector

CSS has a new :has() selector, often referred to as a "parent selector", which allows CSS rules to be applied to a parent element based on children. For example, you can change the parent layout of a card, but only if it contains an image element: this avoids having to apply a variant class on the parent. This article illustrates this new feature with many use cases. I found interesting the possibility of applying CSS variables on <html> according to the value of a <select> (useful demo for theming or dark mode support). Currently only available in Safari and Chrome Canary, but support could improve fast.

Be careful not to abuse it: in a component model like React, it is better to limit yourself to targeting local classes to avoid breaking the encapsulation model of your component.

New 103 HTTP Status Code (Early Hints)

A new status code is officially added in the HTML spec. It allows sending "early hints" to the browser to prefetch/preload resources before receiving the 200 response from the server. It seems useful particularly for CDNs (read this Cloudflare article) which will be able to send cached early hints (or even predicted through machine-learning 🤯) while fetching fresh content from the origin server.

Building a dialog component

With <dialog> added in Safari 15.4 and growing support, it's time to take a look at this new element. Adam Argyle offers us a fairly complete article on the subject: based on the most modern web APIs, he implement a mega/mini modals with animation, accessibility, responsive, light dismiss, custom events...

Extras:


CleanShot 2022-04-20 at 09 39 20@2x

Top comments (0)