React
React 18 RC1应该在本周发布,由Andrew Clark宣布:"关于React 18的小更新:我们正计划在下周发布另一个RC,其中包括对错误报告的改进。"
它提供了一个新的API onRecoverableError。这个想法是为了能够记录/报告(通过reportError)React中可能发生的 "可恢复的错误",特别是在SSR和CSR之间存在一些不适配的交融过程中。
很好的版本,包括最令人期待的功能之一:按需的增量静态再生(ISR)。一个新的API unstable_revalidate("/static-page-url")应该对CMS的集成有很大帮助:因为你现在可以在CMS发布时立即得到更新。
在SWC方面:6个新的Babel插件被移植到Rust中(包括Styled-Components和Relay),SWC minify在发布选择队列中,以及与Jest更好的零配置集成。
在React 18和服务器组件支持方面也有一些明显的进展,但仍处于alpha阶段。
也请看 Lee的介绍视频或 Delba的按需ISR演示。
一个有趣且部署相关的版本的版本:新的 "serverBuildTarget "选项用于配置构建(目录、模块格式),可以在单个输出文件中构建服务器,还有一个新的实验性适配器用于在Deno上部署。
The React.ReactNode type is a black hole
长久以来广为人知的问题是,TypeScript的 "ReactNode "类型过于宽松,不允许在编译时捕获一些错误。Kevin建议创建一个StrictReactNode类型,并提供一个ESLint规则来禁止使用ReactNode。 Similar article.
拓展阅读:
- 📜 Putting test files in the pages folder in a Next.js app: 如果你想把故事和测试与Next.js页面放在一起,那么Next.js提供了一个有用的技巧:
pageExtensions配置 - 📜 Deep dive into React keys bugs: 解释与 "key "props有关的各种问题并提出解决方案
- 📦 React-Runner: 新的现代React-Live的替代方案,提供实时编辑器+预览,基于Sucrase而不是Bublé。这很有希望,最终可能被新的新的 React docs 和 Docusaurus采用。
- 📦 Tunnel-Rat: n基于Zustand的新Poimandres库,可以创建一个 "React tunnel",将JSX从一棵树传送到另一棵树。另见React-Teleporter.
- 🔗 Nextjs-blog-theme: Next.js + Tailwind blog template provided by Netlify/Bejamas
- 💬 Mark Erikson: "when/why should I use Context, Hooks, Thunks, Sagas, React Query, RTK Query?"
- 📖 Migrating to React Query 4
- 🧵 React Server Components, Vizualized
React-Native
Introducing Fabric to react-native-screens
有了React-Native 0.68,我们可以很容易地激活新的Fabric渲染器!但是,只有在你的lib兼容的情况下,它才能发挥作用。
Software Mansion宣布其承诺,会使libs与Fabric兼容(从React-Native-Screens开始)。
他们鼓励我们这样做,并给我们一些指导(流程和PR)。理念是:创建能与新旧架构同时工作的库,允许渐进式迁移,但不废弃过多的代码。
这非常令人兴奋,社区提供一些反馈:
Note that React-Navigation already works under Fabric with react-native-screens!
Flipper is coming to your web and Node.js apps
Flipper最初是React-Native的一个桌面开发工具,允许你检查日志、网络请求... Andrey介绍了js-flipper:一个允许将Flipper与web或Node.js应用(React 例子)集成的软件包。他分享了Meta的各种使用案例:移动、网络、Node.js、桌面、Oculus Quest......还有一些特定的应用商业使用案例,如提供 "以用户X身份登录 "功能的插件。
Flipper似乎是一个理想的平台,可以建立一个通用的DevTool,只要生态系统跟上,所以Andrey邀请我们所有人都来创建插件。
拓展阅读:
- 📜 Security of React Native libraries: the bad, the worse and the ugly: 一个相当高级的安全审计,批评了React-Native中的许多加密库。该公司建议使用Themis,一个跨平台的加密库(React-Native API在测试阶段),鼓励加密的良好做法,而不需要成为一个加密专家。
- 📜 Expo 101: Building mobile apps in weeks, not years: 优秀的基于AES的整个现代Expo生态系统的概述。他们为我们的移动项目的每个阶段提供了一个工具。
- 📜 Better Credentials Management with Expo Application Services
- 📜 Build a React Native QR Code Scanner using Vision Camera
- 📦 vision-camera-ocr: real-time OCR frame-processor!
- 📦 react-native-safe-area-context v4 RC: Fabric support, backward compatible. Looking for early adopter feedback
- 📦 react-native-url-router + overview
- 🎨 Demo graph React-Native-Skia: more performant than SVG
其它
不出所料,React今年仍然非常受欢迎,但在满意度方面被Svelte和Solid超越。Next.js和Remix的满意度都是91%。请特别阅读 Swyx的结论. A livestream。今天会有一个现场直播。
请记住,这项调查并非没有 偏见,但探索趋势仍然很有趣。Sacha Grief有改善的善意,并解决了Dev.Net上的批评意见。 解决了Dev上的偏见.
拓展阅读:
- Rebuilding Babel: The Tokenizer: 很好的互动文章,很适合学习什么是标记化器
- Express 5.0: 在很长一段时间后的第一个测试版😅在此期间,它的现代竞争者Fastify在JS的状态中名列前茅,并发布了 v4.0.0-alpha.1
- GitHub Actions:
concurrency.cancel-in-progress: 有助于优化你的CI - Node.js:
AbortSignal.timeout()`: new API - new.target: 允许知道一个函数是否是用
new调用的,比instanceof更快。 - CSS Container Queries: 在Webkit中默认启用
- New Google Cloud Functions: 60分钟的执行时间!
- Cross-Browser support with Cross-Origin isolation: 解释了为什么StackBlitz WebContainers只在Chromium中工作
- Create your Chrome Extension using Flutter web: 🤔 这个用例很有趣:一个不需要SEO的拓展
- TypeScript - Implement Rust-style Result: reminds the Either FP type
- Netlify Graph: 收购OneGraph后的Netlify新服务:一个统一的GraphQL API,针对许多其他第三方API
- Node.js Trademarks Transferred to OpenJS Foundation: that would be nice if Oracle also transferred its JavaScript trademarks 😅
- Don't trust JS library size, min+gzip
- Yarn 3.2: Libc, Yarn Explain, Next Major, ...
- Testing Vite with minimal config using Vitest
- SolidJS sponsored by Vercel
- The Story of Asynchronous JavaScript
- "TIL you can write overloads for arrow functions in TypeScript"
- You Can throw() Anything In JavaScript - And Other async/await Considerations
- Exploring model-based testing for UIs
- A Complete Guide to CSS Cascade Layers
- Resumable JavaScript with Qwik
- Deno 1.19
- An Introduction to Deno: Is It Better than Node.js?
- Survivorship Bias in Web Performance
- Hasura: Announcing our $100M Series C funding
- Rome: "A sneak peak of our formatter: being able to format partial broken code!"
- Injecting backdoors to NPM packages
- How to Favicon in 2022: Six files that fit most needs
- tooling.one: collection of useful dev tools
- Four reasons why WebdriverIO is better than Cypress
- Measuring user flow performance with Lighthouse and WebdriverIO
- "In @ChromeDevTools holding SHIFT while moving mouse over resources in network panel shows you which asset caused to load another asset."
- XState -> Mermaid converted?