npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

redux-easy-action

v3.0.3

Published

redux-easy-action

Downloads

48

Readme

redux-easy-action

redux-easy-action 就是为了精简 redux 代码而编写的一个库。

redux 缺点

  • 默认只支持同步处理,连作者创造的redux-thunk都是独立于redux之外的一个包,当然,这样是让使用者自行选择异步处理方法,但是选择太多,又没有各项都见长的解法,所以使用者也抱怨很多。
  • 啰嗦(verbose),为了一个功能又要写reducer又要写action,还要写一个文件定义actionType,显得很麻烦,当然啰嗦就是为了让一切清晰明确。
  • 维护成本高,action 和 reducer 割裂,两者之间的映射关系过于依赖约定,代码量大,阅读与查找不方便。
  • action function 只能通过 mapDispatchToProps 的方式引入,性能调优繁琐。
  • 没有一个完整的规范性写法,导致每个人的写法百花齐放。
  • 对 TypeScript 支持不太友好。

✨特性

  • 无需使用 redux-thunk 即可实现异步 action 的方式。
  • 核心代码只有 80 多行,仅在结构上做了处理,不会影响性能,足够的轻量。
  • 符合函数式编程的方式,代码足够简单。
  • 提供一键创建 store 的方式,无必要编写 redux 的初始代码。
  • 不需要编写 reducer,这部分会在初始化的时候自动构建。
  • 提供 commit 用于更新 store,其行为类似 react 的 this.setState 函数,非常简便。
  • 使用逻辑拆分(combineReducers)方式,每一个拆分被认为是一个 model。
  • 提供可以在 connect 之外调用 action 函数的方式。
  • 提供全局的数据获取方式,可以在 conncet 之外获取到 store 的数据。
  • 在 v2.0 版本里添加了对 TypeScript 的支持。