淘系前端架构周刊:ahooks 3.0 发布、Tailwind CSS v3.0
昭昭前事,惕惕后人。
🗞 News
ahooks 3.0 发布
ahooks 作为 React 社区中优质可靠的 Hooks 库,经过近两年多的迭代,在国内外社区都获得了很多同学的认可,时至今日 ahooks 发布 3.0 版本,为我们带来了以下新特性:
-
全面支持 SSR
-
全新的 useRequest
-
所有的输出函数引用是固定的,避免闭包问题
-
DOM 类 Hooks 支持 target 动态变化
-
更合理的 API 设计
-
解决了在严格模式(Strict Mode)下的问题
-
解决了在 react-refresh(HMR)模式下的问题
-
新增了更多 Hooks
-
&etc.
Release Blog:ahooks 3.0 来了!高质量可靠的 React Hooks 库 - 知乎 (zhihu.com)
Home Page:ahooks - React Hooks Library - ahooks 3.0
GitHub Repo:GitHub - alibaba/hooks: A high-quality & reliable React Hooks library.
Tailwind CSS v3.0
此次更新,为我们带来了以下新特性:
-
运行时引擎(师承 WindiCSS)
-
开箱即用的颜色系统
-
可定制颜色的 box-shadow
-
Scroll snap API
-
多列布局
-
LTR & RTL 修饰符
-
&etc.
Release Blog:Tailwind CSS v3.0 – Tailwind CSS
GitHub Repo:tailwindlabs/tailwindcss: A utility-first CSS framework for rapid UI development. (github.com)
📦 Open Source
fiber
一个受 Express 启发的 Web 应用框架,使用 Go 开发,语法与 Express 相近,同时性能也非常强劲。\
基础路由:
func main() { app := fiber.New() // GET /api/register app.Get("/api/*", func(c *fiber.Ctx) error { msg := fmt.Sprintf("✋ %s", c.Params("*")) return c.SendString(msg) // => ✋ register }) // GET /flights/LAX-SFO app.Get("/flights/:from-:to", func(c *fiber.Ctx) error { msg := fmt.Sprintf("💸 From: %s, To: %s", c.Params("from"), c.Params("to")) return c.SendString(msg) // => 💸 From: LAX, To: SFO }) // GET /dictionary.txt app.Get("/:file.:ext", func(c *fiber.Ctx) error { msg := fmt.Sprintf("📃 %s.%s", c.Params("file"), c.Params("ext")) return c.SendString(msg) // => 📃 dictionary.txt }) // GET /john/75 app.Get("/:name/:age/:gender?", func(c *fiber.Ctx) error { msg := fmt.Sprintf("👴 %s is %s years old", c.Params("name"), c.Params("age")) return c.SendString(msg) // => 👴 john is 75 years old }) // GET /john app.Get("/:name", func(c *fiber.Ctx) error { msg := fmt.Sprintf("Hello, %s 👋!", c.Params("name")) return c.SendString(msg) // => Hello john 👋! }) log.Fatal(app.Listen(":3000")) }
静态资源服务:
func main() { app := fiber.New() app.Static("/", "./public") // => http://localhost:3000/js/script.js // => http://localhost:3000/css/style.css app.Static("/prefix", "./public") // => http://localhost:3000/prefix/js/script.js // => http://localhost:3000/prefix/css/style.css app.Static("*", "./public/index.html") // => http://localhost:3000/any/path/shows/index/html log.Fatal(app.Listen(":3000")) }
中间件:
func main() { app := fiber.New() // Match any route app.Use(func(c *fiber.Ctx) error { fmt.Println("🥇 First handler") return c.Next() }) // Match all routes starting with /api app.Use("/api", func(c *fiber.Ctx) error { fmt.Println("🥈 Second handler") return c.Next() }) // GET /api/list app.Get("/api/list", func(c *fiber.Ctx) error { fmt.Println("🥉 Last handler") return c.SendString("Hello, World 👋!") }) log.Fatal(app.Listen(":3000")) }
相信熟悉 Express 的同学对它应该不会太陌生。
性能也非常强劲:
Home Page:Fiber (gofiber.io)
GitHub Repo:gofiber/fiber: ⚡️ Express inspired web framework written in Go (github.com)
Happy DOM
一个 jsdom 的替代品,用于支持 Web Components 的 SSR,旨在支持浏览器更多浏览器常用的功能。
Benchmark:
Operation | JSDOM | Happy DOM |
---|---|---|
Import / Require | 333 ms | 45 ms |
Parse HTML | 256 ms | 26 ms |
Serialize HTML | 65 ms | 8 ms |
Render custom element | 214 ms | 19 ms |
querySelectorAll('tagname') | 4.9 ms | 0.7 ms |
querySelectorAll('.class') | 6.4 ms | 3.7 ms |
querySelectorAll('[attribute]') | 4.0 ms | 1.7 ms |
querySelectorAll('[class~="name"]') | 5.5 ms | 2.9 ms |
querySelectorAll(':nth-child(2n+1)') | 10.4 ms | 3.8 ms |
amis
amis 是一个低代码前端框架,它使用 JSON 配置来生成页面,可以减少页面开发工作量,极大提升效率。
Home Page:介绍 (gitee.io)
GitHub Repo:baidu/amis: 前端低代码框架,通过 JSON 配置就能生成各种页面。 (github.com)
Mitosis
一款类 React 框架,口号是编写一次组件,在任何框架中使用,采用编译的方式将其编译为 Vue/React/SolidJS/Angular/Svelte 等组件。
📑 Article
TypeScript 类型中的逆变协变

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
Bean Searcher 发布 v3.0.5 版本
Bean Searcher 发布 v3.0.5 版本,,具体更新内容如下: Bean Searcher 无@DbIgnore也自动忽略实体类中的静态字段 Bean Searcher Boot Starter 使用 Searcher 类型注入检索器时,默认注入 MapSearcher,不再报错 提高兼容性,SpringBoot 最低版本支持到 v1.4+ https://github.com/ejlchina/bean-searcher https://gitee.com/ejlchina-zhxu/bean-searcher 2021年度 OSC 中国最佳开源项目评选,来投上一票吧: https://www.oschina.net/project/top_cn_2021/?id=627
- 下一篇
Beerus 上线啦,用 Go 开发的 web 解决方案
Beerus是一个用 Go 开发的 web 解决方案,包含一个 web 框架,一个数据库操作框架,一个正在规划中的RPC框架,目前 web 框架和数据库操作框架已经发布了第一个版本。 Web框架 因为他是牵头的框架,说到web大家想到的肯定是接口管理,所以他的名字就直接沿用了Beerus,也就是这一套项目的品牌名称,它是以net/http 为基础,在此基础上扩展了路由的管理方式,并增加了拦截器,会话管理,用struct接收参数,参数验证等功能,还提供了WebSocket支持,可以将http协议升级到WebSocket 并实现通信 数据库操作框架 名字叫Beerus-DB,用到了[go-sql-driver/mysql]来做数据库连接与基础操作,在此基础上做了很多扩展,比如:连接池管理,多数据源,事务管理,单表无sql操作,多表以及复杂操作可以自己写sql,sql支持{}占位符,可以用struct作为参数来操作数据库等 示例 HTTP 示例 创建一个函数管理路由 func CreateRoute() { // post route example route.POST("/ex...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- SpringBoot2全家桶,快速入门学习开发网站教程
- CentOS8编译安装MySQL8.0.19
- SpringBoot2整合MyBatis,连接MySql数据库做增删改查操作
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- CentOS8,CentOS7,CentOS6编译安装Redis5.0.7
- CentOS7,CentOS8安装Elasticsearch6.8.6
- SpringBoot2初体验,简单认识spring boot2并且搭建基础工程
- SpringBoot2整合Thymeleaf,官方推荐html解决方案
- 设置Eclipse缩进为4个空格,增强代码规范
- SpringBoot2编写第一个Controller,响应你的http请求并返回结果