Skip to content

bspaulding/redux-thunk-state-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redux-thunk-state-adapter

A utility to provide a facade of getState to an externally owned thunk. This is useful when you are sharing action creators which compose selectors that assume a certain state shape.

Usage

import { createThunkAdapter } from 'redux-thunk-state-adapter';
import { externalThunkCreator } from 'some-module';

// provide a transform function to map InternalState -> ExternalState
const externalThunkAdapter = createThunkAdapter((state) => ({
  user: {
    timezone: state.environment.userTimezone
  }
}));

const adaptedExternalThunk = externalThunkAdapter(externalThunkCreator);

About

A utility to provide a facade of getState to an externally owned thunk.

Resources

Stars

Watchers

Forks

Packages

No packages published