0.3.13 • Published 5 years ago

odux v0.3.13

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Odux

English | 简体中文

CI Coverage Version License

A friendly and easy-to-use front-end state management library. (need TypeScript)


Feature

  • Out of box, Low learning costs and less concept
  • Type friendly, Describe the data model using OO, intuitive
  • Easy to integrate, Can be seamlessly integrated into the other Redux-based state management system, or run independently from Redux

Install

npm i odux --save

Quick Start

First

TypeScript config:

// tsconfig.json
{
  "compilerOptions": {
    ...
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}

Store/Model

class AStore extends BaseStore {
  testData = {
    str: 'Hello World!',
    count: 0,
  };

  add() {
    this.testData.count++;
  }
}

Component

@connect()
class App extends PureComponent {
  @inject()
  aStore: AStore;

  onClick = () => {
    this.aStore.add();
  };

  render() {
    const { testData } = this.aStore;
    return (
      <div>
        <p>{testData.str}</p>
        <p>count: {testData.count}</p>
        <button onClick={this.onClick}>Add</button>
      </div>
    );
  }
}

Demo

Integration with other redux-base

dva

const odux = createOduxForDva();
const app = dva({
  extraEnhancers: [odux.extraEnhancers],
  onReducer: odux.onReducer,
  // onReducer: reducer => otherReducer(odux.onReducer(reducer)),
});

createOduxEnhancer

Thanks

immer

0.3.13

5 years ago

0.3.12

5 years ago

0.3.11

5 years ago

0.3.10

5 years ago

0.3.9

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago