https://github.com/brianneisler/duxegg
Simple module concept for redux
https://github.com/brianneisler/duxegg
Last synced: 4 months ago
JSON representation
Simple module concept for redux
- Host: GitHub
- URL: https://github.com/brianneisler/duxegg
- Owner: brianneisler
- License: other
- Created: 2017-11-18T17:11:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-26T03:23:34.000Z (about 7 years ago)
- Last Synced: 2025-02-22T20:35:34.378Z (4 months ago)
- Language: JavaScript
- Size: 202 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# duxegg
Simple module concept for redux
## Benefits
- Simple module concept for abstracting redux dependencies from one another
- Modules are easy to compose together
- Simple hook system for tapping in to redux lifecycle
- Provides a framework for building out an entire application (if desired)## Build Status
[](https://badge.fury.io/js/duxegg)
[](https://travis-ci.org/brianneisler/duxegg)
[](https://nodei.co/npm/duxegg/)## Install
```bash
npm install --save duxegg
```## Usage
```js
// app.js
import React from 'react'
import { Provider } from 'react-redux'
import { createStore } from 'duxegg'
import * as modules from './modules'const config = {
foo: { // config passed to module is based on name of module
key: 'value'
}
}const App = () =>
...
export default App
``````js
// modules/index.js
import * from 'foo'
export {
foo
}
``````js
// modules/foo/index.js
import { handleActions } from 'redux-actions'
import createSagaMiddleware from 'redux-saga'const module = (config) => {
const middleware = createSagaMiddleware()const reducer = handleActions({
...
})const saga = function* saga() {
...
}const run = (store) => {
// store is a redux store with an additional getModules method
const modules = store.getModules()// do whatever you need to boot up this module or process some value from the other modules
}return {
middleware,
reducer,
saga
}
}export {
module
}
```