https://github.com/rmariuzzo/re-ducks
Library to reduce common tasks for React apps based on re-ducks (https://github.com/alexnm/re-ducks)
https://github.com/rmariuzzo/re-ducks
ducks re-ducks react
Last synced: about 1 month ago
JSON representation
Library to reduce common tasks for React apps based on re-ducks (https://github.com/alexnm/re-ducks)
- Host: GitHub
- URL: https://github.com/rmariuzzo/re-ducks
- Owner: rmariuzzo
- Created: 2017-02-28T19:39:14.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-07T23:03:00.000Z (about 8 years ago)
- Last Synced: 2025-03-15T07:16:22.967Z (2 months ago)
- Topics: ducks, re-ducks, react
- Language: JavaScript
- Size: 348 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# re-ducks
Library to reduce common tasks for React apps based on re-ducks (https://github.com/alexnm/re-ducks)## Usage
### Types
```js
import { types } from 're-ducks'export default types(['create', 'update', 'remove' ])
// > { create: 'create', update: 'update', remove: 'remove'}
``````js
import { types } from 're-ducks'export default types('app/users', [
'create',
'update',
'remove',
])
// > { create: 'app/users/create', update, 'app/users/update', ... }
```### Actions
```js
import { actions } from 're-ducks'
import types from './types'export default actions(types, [
['create'],
['update'],
['remove'],
])
// > {
// > create: (value) => { type: 'create' },
// > update: (value) => { type: 'update' },
// > remove: (value) => { type: 'remove' },
// > }
``````js
import { actions } from 're-ducks'
import types from './types'export default actions(types, [
['create', 'user'],
['update', 'user'],
['remove', 'user'],
])
// > {
// > create: (value) => { type: 'create', payload: { user: value } },
// > update: (value) => { type: 'update', payload: { user: value } },
// > remove: (value) => { type: 'remove', payload: { user: value } },
// > }
````