ericelliott / autodux

Automate the Redux boilerplate.
MIT License
592 stars 32 forks source link

Create an action creator for clearing the reducer #118

Closed janhesters closed 1 year ago

janhesters commented 5 years ago

I often find myself writing a clear action creator:

import autodux from 'autodux';

const initial = '';

export const {
  reducer: name,
  actions: { setName, clearName },
  selectors: { getName },
} = autodux({
  slice: 'name',
  initial,
  actions: {
    clearName: () => initial,
  },
});

I'm interested in creating a PR to add this clear action creator for the slice and each key of the initial object (similar to the set action creator). Would you be open for that?