Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alnorris/redux-actiontyper
Helper to create less verbose action types for Redux
https://github.com/alnorris/redux-actiontyper
Last synced: 27 days ago
JSON representation
Helper to create less verbose action types for Redux
- Host: GitHub
- URL: https://github.com/alnorris/redux-actiontyper
- Owner: alnorris
- Created: 2017-07-18T15:16:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-12T20:17:55.000Z (11 months ago)
- Last Synced: 2024-10-08T22:58:00.924Z (about 1 month ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 57
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Action Typer
Helper to create slightly less verbose redux action types. Uses ES6 Proxies!
**Highly Performant**: Proxy is only run once at startup.
Includes optional prefixer
# Warning
redux-actiontyper requires native ES6 proxy support. Due to the limitations of ES5, Proxies cannot be transpiled or polyfilled to old browsers. If you need to support old browsers please check [caniuse](https://caniuse.com/#feat=proxy) to see if this package is appropriate for your project.
## Install
`npm install redux-actiontyper --save`
or for yarn users
`yarn add redux-actiontyper`
## Old way
```javascript
const GET_CLIENTS = 'GET_CLIENTS'
const GET_CLIENTS_SUCCESS = 'GET_CLIENTS_SUCCESS'
const GET_CLIENTS_FAIL = 'GET_CLIENTS_FAIL'
const SET_CLIENTS_FILTER = 'SET_CLIENTS_FILTER'
```## New Way
```javascript
import actionTyper from 'redux-actiontyper';const { GET_CLIENTS,
GET_CLIENTS_SUCCESS,
GET_CLIENTS_FAIL,
SET_CLIENTS_FILTER } = actionTyper('HomeState/');
console.log(GET_CLIENTS) // HomeState/GET_CLIENTS
console.log(GET_CLIENTS_FAIL) // HomeState/GET_CLIENTS_FAIL
```