前端周热点101: Astro, Redwood, Next.js, Remix, React-Admin, WebComponent

693 阅读4分钟

React

Astro Server-Side Rendering

Astro是一个现代元框架,能够使用任何UI库(包括React)。它现在支持服务器端渲染,在v1.0 beta测试版中可以实验。与Remix一样,该框架提供了一个 adapters层,用于部署到多个目标。

React-admin V4: Build Your Own Framework

François以React中一个简单的管理界面为例,该界面基于MUI和React-Hook-Form。这段代码最初是相当冗长的,有90行。他通过抽象和复用,重构了这段代码,最终实现相同的效果只用了20行代码。

他解释说,这些抽象实际上是React-Admin的第四版(v4.0.0-RC.1)。这个新版本基于更现代的堆栈,并且更加模块化:它暴露了高级组件(默认基于MUI,可以交换),但也有低层单元来创建你自己的框架。v4的全部系列文章

An Overlooked Factor For Performance Optimization In React

Interesting reflection on the need (or not) to memoize the value of a React context according to the position of the provider in the tree. Personally, I still prefer to always memoize for safety, as you never know if the provider will not be moved somewhere else.

关于是否需要(或不需要)根据provider在树中的位置来记忆React上下文的值的有趣的思考。就个人而言,为了安全起见,我还是倾向于总是记忆化,因为你永远不知道提供者是否会被移到其他地方。

Writing Redux Reducers in Rust

通过WebAssembly将现有的Rust业务代码整合到React应用中,以及遇到的挑战:非理想的绑定,序列化WASM桥梁等场景的反馈。他们需要在两边(Rust和TypeScript)访问相同的状态。解决方案:在Rust中创建还原器,并向TypeScript返回一个状态差异。

How to Create and Export Web Components From a React Application

展示了如何使用React来创建一个Web组件。它看起来比较简单,在一些特定的情况下🤔可能会很有用。不要与React的Web Components的使用相混淆(以后将正式支持)。

React components composition: how to get it right

Gives some hints on when/how to split into smaller subcomponents. Also evokes an important Clean Code principle (without naming it): Single Level of Abstraction.

对何时/如何分割成更小的子组件给出了一些建议。也唤起了一个重要的清洁代码原则(没有命名它)。单一层次的抽象

拓展阅读:

React-Native

其它

Announcing TypeScript 4.7 Beta

Another great TypeScript release! The long-awaited ES Modules support and package.json "exports" which allows to create several entry points for the same Node.js package. Many other improvements and new features, including "moduleSuffixes" useful for React-Native.

又一个伟大的TypeScript版本! 期待已久的ES模块支持和package.json "exports",允许为同一个Node.js包创建多个入口点。许多其他改进和新功能,包括对React-Native有用的 "moduleSuffixes"

拓展阅读:

CleanShot 2022-04-13 at 10 24 54@2x

订阅原文: