Next.js 12.1 发布、Vue CLI 5.0.1 发布 | 淘系前端架构周刊 220221 期

2,332 阅读1分钟

🗞 News

Next.js 12.1 发布

2 月 18 日,Next.js 发布了 12.1 版本,本次更新带来了以下新特性:

  • 按需 ISR(Beta)
  • 拓展了 SWC 支持,styled-components,Relay 以及更多
  • 无需配置的基于 SWC 的 Jest 支持
  • 基于 SWC 的更快的压缩能力,比 Terser 快 7 倍
  • React 18 和 Server Components 支持(Alpha)
  • &etc.

Release Blog:Blog - Next.js 12.1 | Next.js (nextjs.org)

Vue CLI 5.0.1 发布

4 天前,Vue CLI 发布了 5.0.0 后的第一个正式版本 5.0.1,意味着 Vue CLI 5 已经稳定,如果还在使用 Vue CLI 4,可以通过升级指引进行升级:Migrate from v4 | Vue CLI (vuejs.org)

Release Message:Releases · vuejs/vue-cli (github.com)

2021 JavaScript 从业者统计

数据链接:The State of JS 2021: 从业者统计

📦 Open Source

useStateMachine

一个小于 1kb 的极简状态机 Hook。

使用方式:

const [state, send] = useStateMachine({
  initial: 'inactive',
  states: {
    inactive: {
      on: { TOGGLE: 'active' },
    },
    active: {
      on: { TOGGLE: 'inactive' },
      effect() {
        console.log('Just entered the Active state');
        // Same cleanup pattern as `useEffect`:
        // If you return a function, it will run when exiting the state.
        return () => console.log('Just Left the Active state');
      },
    },
  },
});

console.log(state); // { value: 'inactive', nextEvents: ['TOGGLE'] }

// Refers to the TOGGLE event name for the state we are currently in.

send('TOGGLE');

// Logs: Just entered the Active state

console.log(state); // { value: 'active', nextEvents: ['TOGGLE'] }

GitHub Repo:cassiozen/useStateMachine: The <1 kb state machine hook for React (github.com)

📑 Article

SolidJS vs React: I've Built the Same App On Both Libraries.

原文链接:SolidJS vs React: I've Built the Same App On Both Libraries. - DEV Community

How React server components work: an in-depth guide

原文链接:How React server components work: an in-depth guide (plasmic.app)

React Hooks 状态管理方案解析

原文链接:React Hooks 状态管理方案解析 - 知乎 (zhihu.com)