Gathering detailed insights and metrics for redux-actions-helper
Gathering detailed insights and metrics for redux-actions-helper
Gathering detailed insights and metrics for redux-actions-helper
Gathering detailed insights and metrics for redux-actions-helper
redux-actions-creator
redux helper to create redux actions & reducers with Immutable(seamless-immutable)
redux-rest-helper-for-loopback
Redux rest helper help you to create rest Actions and Reducers
redux-api-actions
redux-api-middleware's helper to support create api actions.
redux-connect-actions
Redux helper to handle actions
npm install redux-actions-helper
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
19 Stars
34 Commits
3 Forks
1 Watchers
1 Branches
2 Contributors
Updated on Aug 16, 2023
Latest Version
1.0.4
Package Id
redux-actions-helper@1.0.4
Unpacked Size
24.07 kB
Size
5.46 kB
File Count
13
NPM Version
5.10.0
Node Version
8.11.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
helper for redux-actions
1npm install redux-actions-helper --save
1createAction(
2 actionsName:string,
3 payloadCreator: function,
4 metaCreator: function,
5)
payloadCreator: (args) => payload
default: (...args) => args
metaCreator: (args) => payload
default: (...args) => args
1// actions/todo.js 2 3import { createAction } from 'redux-actions-helper'; 4 5export const toggleTODO = createAction( 6 'TOGGLE_TODO' 7); 8 9export const updateTODO = createAction( 10 'UPDATE_TODO', (task)=>({ 11 id: task.id, 12 task 13 }) 14); 15 16// you can get action name by name attribute or toString method 17// toggleTODO.actionName is equal 'TOGGLE_TODO' 18// toggleTODO.toString() is equal 'TOGGLE_TODO' 19
mapToAction then use it
1// app/Home.js 2 3this.props.toggleTODO(1) 4 5this.props.updateTODO({ 6 id: 1, 7 title: 'new' 8})
1// reducer/todo.js 2import { listenActions, handleActions } from 'redux-actions-helper'; 3import * as todoActions from '../../actions/todo' 4 5const initState = { 6 tasks: [] 7} 8 9export default listenActions((on) => { 10 on(todoActions.toggleTODO, (state, action) => { 11 const taskId = action.payload 12 return { 13 ... 14 } 15 }) 16 on(todoActions.updateTODO, (state, action) => { 17 const {id, task} = action.payload 18 return { 19 ... 20 } 21 }) 22}, initState) 23 24// ==== you also can use handleActions , is same 25 26handleActions({ 27 [todoActions.toggleTODO]:(state, action) => { 28 const taskId = action.payload 29 return { 30 ... 31 } 32 }, 33 [todoActions.updateTODO]:(state, action) => { 34 const {id, task} = action.payload 35 return { 36 ... 37 } 38 } 39}, initState) 40
add promise-middleware to middlewares
1import { promiseMiddleware } from 'redux-actions-helper'; 2 3applyMiddleware( 4 ... 5 promiseMiddleware, 6 ... 7) 8
1// actions/todo.js 2import { createAction } from 'redux-actions-helper'; 3 4export const updateTODO = createAction( 5 'UPDATE_TODO', (task)=>{ 6 return taskApi.update(task) //api will return a promise 7 } 8);
1// reducer/todo.js 2import { listenActions } from 'redux-actions-helper'; 3import * as todoActions from '../../actions/todo' 4 5const initState = { 6 tasks: [] 7} 8 9//handleActions 10handleActions({ 11 [todoActions.updateTODO]:(state, action) => { 12 // api start 13 const requestArguments = action.payload // task 14 return { 15 ... 16 } 17 }, 18 [todoActions.updateTODO.success]:(state, action) => { 19 // promise resolve 20 const response = action.payload 21 const requestArguments = action.meta // task 22 return { 23 ... 24 } 25 }, 26 [todoActions.updateTODO.fail]:(state, action) => { 27 // promise reject 28 const error = action.payload 29 const requestArguments = action.meta // task 30 return { 31 ... 32 } 33 } 34}, initState) 35 36//listenActions 37export default listenActions((on) => { 38 on(todoActions.updateTODO, (state, action) => { 39 // api start 40 const requestArguments = action.payload // task 41 return { 42 ... 43 } 44 }) 45 on.success(todoActions.updateTODO, (state, action) => { 46 // promise resolve 47 const response = action.payload 48 const requestArguments = action.meta // task 49 return { 50 ... 51 } 52 }) 53 on.fail(todoActions.updateTODO, (state, action) => { 54 // promise reject 55 const error = action.payload 56 const requestArguments = action.meta // task 57 return { 58 ... 59 } 60 }) 61}, initState) 62
if you use thunk middleware, you can use createThunkAction
1createThunkAction(
2 actionsName: string,
3 payloadCreator: ({ dispatch, getState }, args) => payload,
4 metaCreator: (args) => meta,
5)
1// actions/todo.js 2import { createThunkAction } from 'redux-actions-helper'; 3 4export const updateTODO = createThunkAction( 5 'UPDATE_TODO', ({ dispatch, getState }, task)=>{ 6 const state = getState() 7 return { 8 id: task.id, 9 task, 10 operator: state.user.id 11 } 12 } 13);
use it as same as createAction createThunkAction will auto create 'pending, success, fail' action.
1// app/Home.js 2 3this.props.updateTODO({ 4 id: 1, 5 title: 'new' 6})
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/29 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
70 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More