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 🙏

© 2024 – Pkg Stats / Ryan Hefner

reduxigen

v2.0.2

Published

Ridiculously Simple State Management

Downloads

201

Readme

logo Reduxigen

Greenkeeper badge Build Status Dependencies Current Version

Reduxigen

Reduxigen is a ridiculously simple state management system. Managing state in Reduxigen entails only two concepts:

  • State

  • Functions

State is a plain JavaScript object.

Reduxigen functions update values in the state.*

Reduxigen is also ridiculously small. It's only ~250 loc.--2.1 kb compressed.

Robust

Reduxigen is built on top of Redux. If you've used Redux, many of the concepts in Reduxigen will be very familiar. However, you'll find using Reduxigen much simpler than Redux. You'll write less code. The code you write will be predictable. This will make you more efficient, and less prone to error. At the same time, you'll get all the benefits Redux has to offer.


* More accurately, Reduxigen functions create a new state with appropriately updated values.

To see an example of Reduxigen in action, you can view this example repository

To read about Reduxigen in depth, please consult the Reduxigen GitBook.

TOC

Summary

The Reduxigen API exposes a set of functions. There are four functions:

  • update
  • asyncUpdate
  • action
  • set

Setup

Install from NPM

If you don't have react and redux already installed, then you'll need to install them. The minimum install for this would be:

npm i react react-dom redux react-redux

If you need to have async operations in your app, also install redux-thunk.

If your app is already configured to work with react and redux, all you have to do is install Reduxigen. Reduxigen plays nicely with other Redux tools such as Redux Saga, or Redux Observable.

To install Reduxigen:

npm i reduxigen

Quick Start

Getting up and running with Reduxigen is easy.

Configure

  1. Create a default state:
export default {
  test: ""
}
  1. Create a store:
import { createStore, applyMiddleware } from "redux";
import thunk from "redux-thunk"; // If you're using thunks
import { rootReducer } from "reduxigen";
import DEFAULT from "state";

export default createStore(rootReducer(DEFAULT), applyMiddleware(thunk));

Create Actions

import { set } from 'reduxigen';

// Note that the value "test" corresponds to the "test" field in the state object.
export const setTest = set("test");

Connect actions to your component

Import this action into your component, and connect it.

import React from 'react';
import {setTest} from './test-actions';
import {connect} from "react-redux";

export const Test = ({test, setTest}) => <button onClick={setTest}>{test}</button>;

const mapStateToProps = state => {test: state.test}

export default connect(mapStateToProps, {setTest})(Test);

API

For full details on the Reduxigen API, please consult the Reduxigen GitBook.