https://github.com/alnorris/redux-actiontyper
Helper to create less verbose action types for Redux
https://github.com/alnorris/redux-actiontyper
Last synced: about 1 month 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 (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-12T20:17:55.000Z (over 1 year ago)
- Last Synced: 2025-04-17T17:21:57.552Z (about 1 month ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 57
- Watchers: 0
- 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
```