Git Product home page Git Product logo

hook-service's Introduction

hook-service

Build Status License

Monorepo of service、state manager for Vue2/Vue3/React. minzipped less than 300 bytes

极其精简的状态管理库,提供了 Vue2/3 和 React 版本。minzipped 不超过 300 bytes


name npm version bundle size framework
vue-hook-svc npm npm vue
react-hook-svc npm npm react

我所期望的状态管理

  1. 可以区分 全局/业务级
    • 全局是单例
    • 业务级有生命周期
  2. 有一个 reactive 的 state ,随便你在哪里用
  3. 有对应的业务方法,供对应业务组件使用
    • 大部分业务应该放在 service 里面声明。 service.method()
    • 不需要 props, emit, dispatch。 组件间传值可以是多余的。
  4. 使用简单,不要有太多概念,可以用常规优化方式
    • 我不想知道 mutations, actions, dispatch, reducer, combineXXX...
    • 时间旅行 等概念很强大,但是 99% 的情况用不上,不需要。

不仅仅是 store,更是 service

一个系统,亦或一块业务、一个组件,应该分为 数据业务UI 3 部分。

常见的 store 往往只是数据层,我希望 状态管理(service) 可以作为 数据+业务,组件(UI)只需要展示 service 的数据,调用 service 的方法。

hook-service's People

Contributors

shalldie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.