# candee

> A react framework that encapsulates the redux.

Latest version **1.3.1** (published 2018-07-16) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2018-07-16 |
| First published | 2018-06-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 26.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 30 |
| Author | lvhaohua |
| Maintainers | lvhaohua |
| Keywords | react, redux, react-router, candee, react-candee, framework |

## Links

- npm: https://www.npmjs.com/package/candee
- Repository: https://github.com/lvhaohua/react-candee
- Homepage: https://github.com/lvhaohua/react-candee#readme
- Issues: https://github.com/lvhaohua/react-candee/issues
- npm.io page: https://npm.io/package/candee

## Dependencies (6)

- [react](https://npm.io/package/react.md) ^16.4.0
- [redux](https://npm.io/package/redux.md) 3.7.2
- [react-redux](https://npm.io/package/react-redux.md) ^5.0.7
- [react-router](https://npm.io/package/react-router.md) ^4.3.0
- [react-router-dom](https://npm.io/package/react-router-dom.md) ^4.3.0
- [react-router-redux](https://npm.io/package/react-router-redux.md) next

## 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.3.1 (latest) — 2018-07-16
- 1.3.0 — 2018-07-16
- 1.2.5 — 2018-07-13
- 1.2.4 — 2018-06-26
- 1.2.3 — 2018-06-26
- 1.2.2 — 2018-06-20
- 1.2.1 — 2018-06-20
- 1.2.0 — 2018-06-19
- 1.1.1 — 2018-06-19
- 1.1.0 — 2018-06-12
- 1.0.9 — 2018-06-08
- 1.0.8 — 2018-06-08
- 1.0.7 — 2018-06-08
- 1.0.1 — 2018-06-08

## README

# react-candee
A react framework that encapsulates the redux.

### API Introduction

#### 1.defaults
```js
// initial config
import candee from 'candee';

candee.defaults({
  initialState: '',
  reducers: {},
  addEffects: (effects)=>{},
  middlewares: [],
  historyMode: '', // hash browser memory
})
```

#### 2.render
```js
// render API encapsulates the redux provider and createStore
import { render } from 'candee';
import App from './views/App';
//render 
render(<App />, document.getElementById('root'));
```

#### 3.model
```js
// model template someModel.js 
export default {
  name: 'someModel',

  initialState: {
    a: '',
    b: ''
  },

  reducers: {
    reducerA(state, data) {
      console.log(data);
      return state;
    }
  },

  effects: {
    async effectA(data, getState) {
     const newData =  await fetch('...');
     actions.someModel.reducerA(newData);
    }
  }
};
```

```js
// inject model
import candee from 'candee';
import someModel from './models/someModel';

candee.model(someModel);
```

#### 4.actions

```js
// how to disptach 
import {actions} from 'candee';

actions.[modelName].[reducerName/effectName]
actions.routing.[push/go/...]

```

#### 5.connect
```js
// App.jsx
import React, { Component } from 'react';
import { connect } from 'candee';

class App extends Component {
  componentDidMount(){
    actions.someModel.reducerA(data);
  }
  // render(){...}
}

export default connect((state) => {
  return {
    states: state.someModel
  };
})(App);
```

#### 6.Router
```js
import { Router, Route, Switch, Redirect } from 'candee';
export default () => (
    <Router>
      <Switch>
        <Route path="/user" component={...} />
        <Route path="/" component={...} />
        <Redirect to="/" />
      </Switch>
    </Router>
);
```

#### 7.dynamic
```js
  const routeConfig = {
    model: () => [import("./model/login"),import("./model/regist")],
    component: () => import("./routes/Login")
  };
  <Route path="/login" component={dynamic(routeConfig)} />
```

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