# morex

> 基于 React 新 Context API 的状态管理

Latest version **1.2.9** (published 2018-11-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install morex
pnpm add morex
yarn add morex
bun add morex
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.9 |
| Published | 2018-11-25 |
| First published | 2018-07-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 25.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | wokeyi |
| Maintainers | wokeyi |
| Keywords | react, redux, morex, more |

## Links

- npm: https://www.npmjs.com/package/morex
- Repository: https://github.com/wokeyi/morex
- Homepage: https://github.com/wokeyi/morex#readme
- Issues: https://github.com/wokeyi/morex/issues
- npm.io page: https://npm.io/package/morex

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^16.4.1
- [react-dom](https://npm.io/package/react-dom.md) ^16.4.1
- [react-router-dom](https://npm.io/package/react-router-dom.md) ^4.3.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.9 (latest) — 2018-11-25
- 1.2.8 — 2018-11-11
- 1.2.7 — 2018-10-26
- 1.2.6 — 2018-10-22
- 1.2.5 — 2018-10-22
- 1.2.2 — 2018-07-18
- 1.2.1 — 2018-07-18
- 1.2.0 — 2018-07-18
- 1.1.1 — 2018-07-12
- 1.1.0 — 2018-07-12
- 1.0.1 — 2018-07-12
- 0.1.0 — 2018-07-12

## README

# Morex

基于React新Context Api编写的状态管理框架。使用方法用mirrorx一致

## 快速开始

```sh
$ yarn add morex
$ yarn start
```

### `index.js`

```js
import React from "react";
import { render } from "react-dom";
import more, { actions, connect, AppProvider } from "morex";

more.model({
  name: "app",
  initialState: 0,
  reducers: {
    increment(state) {
      return state + 1;
    },
    decrement(state) {
      return state - 1;
    }
  },
  effects: {
    async incrementAsync() {
      await new Promise((resolve) => {
        setTimeout(resolve, 1000);
      });
      actions.app.increment();
    }
  }
});

const App = connect(state => {
  return { count: state.app };
})(props => (
  <div>
    <h1>{props.count}</h1>
    <button onClick={() => actions.app.decrement()}>-</button>
    <button onClick={() => actions.app.increment()}>+</button>
    <button onClick={() => actions.app.incrementAsync()}>+ Async</button>
    <button onClick={() => actions.routing.push('/other-page')}>to other page</button>
  </div>
));

render((
  <AppProvider>
    <App />
  </AppProvider>
), document.querySelector(".app-container"));
```

---
_Source: https://npm.io/package/morex · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
