
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
thunk-helpers
Advanced tools
> This package provides small helpers to improve your experience with redux-thunk ---
This package provides small helpers to improve your experience with redux-thunk
npm install thunk-helpers
import {
withDispatch,
withState,
withSelectors,
withDispatchAction,
withStateAction,
withSelectorsAction,
} from 'thunk-helpers';
// withDispatch expects function as argument
// returned value will be automatically dispatched
// it works with sync function and promises as well;
// you may return object or array
const fetchUser = (id) => withDispatch(async (/* dispatch, getState, ...dependencies */) => {
const user = await fetch(`/user/${id}`);
return { type: 'USER_FETCHED', payload: user };
});
// withState, works same as withDispatch, but
// automatically call getState, and provide state
// as argument to your action
const exampleAction = () => withState(async (dispatch, state) => {
const { smth } = state;
return { type: 'EXAMPLE', payload: smth }
});
// withSelectors works pretty same as withState,
// but accepts array of selector functions or 1 function
// and replace getState with result of those functions
() => withSelectorsAction(async (dispatch, [ smth ])) => {
return { type: 'EXAMPLE', payload: smth }
}, [ someSelectorFunction ])
// If you don't need provide any param from outside
// All functions have 'action creator',
// In this case inner function will be created only once
const fetchUser = withDispatchAction(async (/* dispatch, getState, ...dependencies */) => {
const user = await fetch('/user/me');
return { type: 'USER_FETCHED', payload: user };
});
const exampleAction = withStateAction(async (dispatch, state) => {
const { smth } = state;
return { type: 'EXAMPLE', payload: smth }
});
withSelectorsAction(async (dispatch, [ smth ])) => {
return { type: 'EXAMPLE', payload: smth }
}, [ someSelectorFunction ])
MIT
FAQs
> This package provides small helpers to improve your experience with redux-thunk ---
We found that thunk-helpers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.