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 🙏

© 2026 – Pkg Stats / Ryan Hefner

pastate

v0.6.31

Published

响应式 react state 管理框架

Downloads

65

Readme

Pastate :响应式 react state 管理框架

简介

Pastate 是一个响应式 react state 管理框架,实现了对 state 的异步响应式管理。Pastate 是一个精益框架,它对很多高级概念进行了友好封装,这意味着你不必学习一些难以理解的概念,就可以在一个简单的应用中便捷地使用 pastate。在应用变得逐渐复杂的过程中,你只要逐渐学习并使用 pastate 中更多的功能,以满日益复杂的系统开发需求。同时,pastate 也是一个向后兼容的渐进式框架,你可以在现有的 react 或 redux 项目中,把一部分组件改用 pastate 来实现,再逐渐拓展到整个项目。

Pastate 主页: https://pastate.js.org

Pastate GitHub: https://github.com/BirdLeeSCUT/pastate (欢迎 star)

简单例子:

const state = store.state

class AppView extends Component {
    increaseAge(){
        state.myInfo.age += 1
    }
    changeName(newName){
        state.myInfo.name = newName
    }
    render() {
        ...
    }
}

你可以直接对 state 节点进行赋值,pastate 的响应式引擎会异步为你更新视图!这种模式比原生 react 的 setState 方法或原生 redux 的 reducer 模式方便灵活很多!

特性

  • 便捷易用:pastate 对高级概念进行了封装,只要有 react 基础知识即可轻松上手
  • 响应式 state: 可以直接用 js 原生模式更新 state 的值,pastate 会响应式地为你更新相关视图
  • 类型提示:pastate 具有完善的类型定义文件,可借助 intelliSense 极大地提高开发效率
  • 按需渲染:pastate 实现了 state 节点按需溯源更新引用机制,视图可以高效响应 state 的变化
  • 异步更新机制:当你对 state 进行连续的修改时,pastate 会高效地为你只做一次异步视图更新
  • 友好的学习曲线:pastate 封装了 flux 模式的高级概念,只需在感兴趣时去了解这些概念
  • 兼容 redux 项目:你可以把 pastate 轻松整合到 redux 项目中,把部分容器实现为 pastate 模式
  • 支持 TypeScript:pastate 本身使用 TpyeScript 进行开发,有完善的类型定义和泛型支持
  • MIT 协议授权 : 你可以免费地在个人或商业项目中使用,并按需修改或扩展

原理简介

Pastate 名字源自 Path State 的简写,pastate 在 state 的每个节点上增加节点的位置(path)信息和 store 归属信息,从而实现对象或数组节点的按需递归引用更新,实现 immutable state 特性,因此 pastate 可以管理复杂的 state 树并实现高效的异步按需渲染。同时 pastate 基于 ES5 的 Object.assign 实现了 state 的全节点响应式操作支持,你只需像修改普通变量一样修改 state 即可, 如 state.userinfo.name = 'myName', 这时 pastate 的响应式引擎会为自动为你异步高效更新相关视图,详细原理请查看原理章节

pastate 原理图

灵感来源

Pastate 受启发于 redux 的 immutable state 管理模式和 vue.js 的响应式 state 设计模式;同时融入的精益(lean)设计思想。

可靠性

Pastate 已经通过 160+ 个测试用例的全面测试,稳定可靠。测试用例的具体内容可查看项目源码中的 src/pastate/tests 目录。

欢迎反馈

如果发现 pastate 的 bug 或有任何建议,欢迎提交 issue,感谢大家的反馈。如果你喜欢 pastate, 希望能给个宝贵的 star ^_^pastate github


Pastate 文档

贡献

非常欢迎大家加入 pastate 的开发小组,pastate 具体的开发说明请看文档的“相关资源”章节。