# freed-framework

> 大致的工作流程 1. App.jsx 2. 调用 actions/*.js 3. actions 调用 fetch(axios.js) 发送数据请求

Latest version **1.0.41** (published 2017-05-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install freed-framework
pnpm add freed-framework
yarn add freed-framework
bun add freed-framework
```

## 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.0.41 |
| Published | 2017-05-26 |
| First published | 2017-05-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 16 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | denglingbo |
| Maintainers | denglingbo |

## Links

- npm: https://www.npmjs.com/package/freed-framework
- npm.io page: https://npm.io/package/freed-framework

## Dependencies (16)

- [step](https://npm.io/package/step.md) ^1.0.0
- [react](https://npm.io/package/react.md) ^15.4.2
- [redux](https://npm.io/package/redux.md) ^3.6.0
- [connect](https://npm.io/package/connect.md) ^3.6.1
- [immutable](https://npm.io/package/immutable.md) ^3.8.1
- [react-dom](https://npm.io/package/react-dom.md) ^15.4.2
- [react-redux](https://npm.io/package/react-redux.md) ^4.4.5
- [redux-thunk](https://npm.io/package/redux-thunk.md) ^2.2.0
- [react-router](https://npm.io/package/react-router.md) ^4.1.1
- [redux-logger](https://npm.io/package/redux-logger.md) ^3.0.1
- [babel-runtime](https://npm.io/package/babel-runtime.md) 6.x
- [redux-immutable](https://npm.io/package/redux-immutable.md) ^4.0.0
- [react-router-dom](https://npm.io/package/react-router-dom.md) ^4.1.1
- [react-router-redux](https://npm.io/package/react-router-redux.md) ^4.0.8
- [redux-devtools-extension](https://npm.io/package/redux-devtools-extension.md) ^2.13.2
- [react-immutable-proptypes](https://npm.io/package/react-immutable-proptypes.md) ^2.1.0

## Recent versions

- 1.0.41 (latest) — 2017-05-26
- 1.0.4 — 2017-05-26
- 1.0.3 — 2017-05-26
- 1.0.2 — 2017-05-26
- 1.0.1 — 2017-05-26
- 1.0.0 — 2017-05-26

## README

大致的工作流程
1. App.jsx
2. 调用 actions/*.js
3. actions 调用 fetch(axios.js) 发送数据请求

***
**切记不要在 constructor 或者 组件的任何位置setState，state全部在reducer初始化**
***

<pre>
Store的数据修改，本质上是通过Reducer来完成的。
Store只提供get方法（即getState），不提供set方法，所以数据的修改一定是通过dispatch(action)来完成，即：action -> reducers -> store
Store除了存储数据之外，还有着消息发布/订阅（pub/sub）的功能，也正是因为这个功能，它才能够同时连接着Actions和Views。
dispatch方法 对应着 pub
subscribe方法 对应着 sub
</pre>

<code>
    import {increase, descrease} from 'it is the path';
    
    const mapDispatchToProps = (dispatch) => bindActionCreators({
      increase,
      decrease
    }, dispatch);
    
    @connect(state => state, mapDispatchToProps)
</code>

**可以用 ES7 的方式简化为**

<code>
    @connect(
        state => state, 
        dispatch => bindActionCreators({increase, decrease}, dispatch)
    )
</code>


**nginx 配制, BrowserHistory**
<code>
    location / {
       try_files $uri /index.html;
    }
</code>


Redux三大原则：

1、单一数据源，这个应用的state被存储在一棵object tree中，并且这个object tree只存在于唯一的Store中。

2、state是只读的，唯一改变state的方法就是触发action，action是一个用于描述已发生事件的普通对象。

3、使用纯函数来执行修改，为了描述action如何改变state tree，需要编写reducer。

Redux数据流的管理：

1、action:把数据传递到Store，唯一数据来源。

2、reducer:action只描述有事情发生，reducer指明如何更新state，即设计state结构和action处理。

3、Store:把action和reducer联系到一起，负责维持、获取和更新state。

4、生命周期：数据流严格且单向

调用Store.dispatch(action)->Store调用传入的reducer函数，Store会把两个参数传入reducer:当前的state树和action->根reducer将多个子reducer输出合并成一个单一的state树->Store保存了根reducer，并返回完整的state树。

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