npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

redux-zero-single-action

v2.0.4

Published

Redux-zero single action

Readme

redux-zero-single-action

Single action for redux-zero which tries to cover most state change operations.

Dependencies

npm i -g npm
npm i redux-zero
npm i react react-dom

Installation

npm i redux-zero-single-action

Usage

In your React component, import actions and the action constants required:

import { connect } from 'redux-zero/react'
import actions, {
  BOOLEAN_TOGGLE
} from 'redux-zero-single-action'

Connect your component to the store:

<< COMPONENT GOES HERE >>

const mapToProps = ({
  propToSet,
}) => ({
  propToSet,
})

export default connect(
  mapToProps,
  actions
)(TestComponent)

Finally use the action in your component:

const TestComponent = ({
  singleAction,
  propToSet,
}) => (
    <div className="container">
      <button
        onClick={() => singleAction({
          keys: ['propToSet', 'propToSetSubKey', 'propToSetSubSubKey'],
          action: GENERAL_SET,
          value: 'new'
        })}
      />
    </div>
  )
}

Example folder coming soon.

Action types

  • GENERAL_SET: default key-value replacement
singleAction({
      keys: ['propToSet', 'propToSetSubKey', 'propToSetSubSubKey'],
      action: GENERAL_SET,
      value: 'new'
    })
  • GENERAL_APPEND: append value to subkey
singleAction({
      keys: ['propToSet', 'propToSetSubKey', 'propToSetSubSubKey'],
      action: GENERAL_APPEND,
      value: 'new'
    })
  • GENERAL_DELETE: remove key
singleAction({
      keys: ['propToSet', 'propToSetSubKey', 'propToSetSubSubKey'],
      action: GENERAL_DELETE,
    })
  • BOOLEAN_TOGGLE: toggle boolean value
singleAction({
      keys: ['propToSet', 'propToSetSubKey', 'propToSetSubSubKey'],
      action: BOOLEAN_TOGGLE,
    })
  • NUMBER_ADD: add number to existing value (if no value, it sets the value as the added number)
singleAction({
      keys: ['propToSet', 'propToSetSubKey', 'propToSetSubSubKey'],
      action: NUMBER_ADD,
      value: 1
    })
  • NUMBER_MULTIPLY: multiply number to existing value (if no value, it sets the value to 0)
singleAction({
      keys: ['propToSet', 'propToSetSubKey', 'propToSetSubSubKey'],
      action: NUMBER_MULTIPLY,
      value: 8
    })
  • OBJECT_SPREAD: spread object value into existing object-type key
singleAction({
      keys: ['propToSet', 'propToSetSubKey', 'propToSetSubSubKey'],
      action: OBJECT_SPREAD,
      value: { id: 1 }
    })
  • ARRAY_PUSH: push valueinto existing array-type key
singleAction({
      keys: ['propToSet', 'propToSetSubKey', 'propToSetSubSubKey'],
      action: ARRAY_PUSH,
      value: 'item
    })
  • ARRAY_PUSH_UNIQUE: push value into existing array-type key only if item is not present in the array
singleAction({
      keys: ['propToSet', 'propToSetSubKey', 'propToSetSubSubKey'],
      action: ARRAY_PUSH,
      value: 'item'
    })
  • ARRAY_TOGGLE: push value into existing array-type key if item is not present in the array, otherwise removes it from the array
singleAction({
      keys: ['propToSet', 'propToSetSubKey', 'propToSetSubSubKey'],
      action: ARRAY_TOGGLE,
      value: 'item'
    })
  • ARRAY_DELETE: removes item from existing array-type key if item is present
singleAction({
      keys: ['propToSet', 'propToSetSubKey', 'propToSetSubSubKey'],
      action: NUMBER_MULTIPLY,
      value: 'item'
    })
  • ARRAY_DELETE_INDEX: removes item from existing array-type key by index, if index is present
singleAction({
      keys: ['propToSet', 'propToSetSubKey', 'propToSetSubSubKey'],
      action: NUMBER_MULTIPLY,
      value: 8
    })

Why redux-zero-single-action?

Redux-zero does a great job in simplifying the Redux flow. Having a single action bring an additional simplification, as:

  • less actions to connect to components and pass around
  • less code
  • focus on functions development rather than store actions

Publishing

Use np to publish the new version to npm.

  git add .
  git commit -m "Message"

Next steps

  • Add example folder