UNPKG

1.96 kBMarkdownView Raw
1# @uppy/store-redux
2
3<img src="https://uppy.io/images/logos/uppy-dog-head-arrow.svg" width="120" alt="Uppy logo: a superman puppy in a pink suit" align="right">
4
5<a href="https://www.npmjs.com/package/@uppy/store-redux"><img src="https://img.shields.io/npm/v/@uppy/store-redux.svg?style=flat-square"></a>
6<a href="https://travis-ci.org/transloadit/uppy"><img src="https://img.shields.io/travis/transloadit/uppy/master.svg?style=flat-square" alt="Build Status"></a>
7
8The `ReduxStore` stores Uppy state on a key in an existing Redux store.
9The `ReduxStore` dispatches `uppy/STATE_UPDATE` actions to update state.
10When the state in Redux changes, it notifies Uppy.
11This way, you get most of the benefits of Redux, including support for the Redux Devtools and time traveling!
12
13Uppy is being developed by the folks at [Transloadit](https://transloadit.com), a versatile file encoding service.
14
15## Example
16
17```js
18const { combineReducers, createStore } = require('redux')
19const Uppy = require('@uppy/core')
20const ReduxStore = require('@uppy/store-redux')
21const reducers = require('./reducers')
22
23const reducer = combineReducers({
24 ...reducers,
25 uppy: ReduxStore.reducer
26})
27
28const store = createStore(reducer)
29
30const uppy = Uppy({
31 store: ReduxStore({
32 store: store
33 })
34})
35```
36
37## Installation
38
39```bash
40$ npm install @uppy/store-redux --save
41```
42
43We recommend installing from npm and then using a module bundler such as [Webpack](http://webpack.github.io/), [Browserify](http://browserify.org/) or [Rollup.js](http://rollupjs.org/).
44
45Alternatively, you can also use this plugin in a pre-built bundle from Transloadit's CDN: Edgly. In that case `Uppy` will attach itself to the global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions.
46
47## Documentation
48
49Documentation for this plugin can be found on the [Uppy website](https://uppy.io/docs/stores#ReduxStore).
50
51## License
52
53[The MIT License](./LICENSE).