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

@mrnafisia/yasm

v0.0.12

Published

Yet another state management!

Downloads

114

Readme

YASM - Your Awesome State Management

YASM is a state management library for React that aims to simplify state management in your applications, reducing boilerplate code and promoting a clean and efficient code style.

Table of Contents

Yet Another State Management?

Why YASM is different from other state managements?

  • Re-usability: Define a reducer once and connect how many states you want.
  • Component-based design: Define a Component and use it how many times you want.
  • Custom Composition: consider you defined a checkbox reducer. you want to show an array of
  • Speed: Unlike Redux, YASM only try to update the updated part of UI. Redux call subscription function of every component. after filtering unchanged states, the rest components will re-render. but YASM knows exactly which component has updated without checking!
  • boilerplate bye-bye

Installation

You can install YASM via npm or yarn:

npm install @mrnafisia/yasm
# or
yarn add @mrnafisia/yasm

Concepts

State structure

Unlike Redux that store their states in nested-structure, YASM use flat-structure. It is main difference and source of the YASM features.

Usage

Defining Section

First, import YASM and initialize it in your application:

import { createStore } from 'yasm';

const store = createStore(initialState);

Defining Actions

Actions are used to modify the state. Define your actions like this:

const increment = (amount) => ({ type: 'INCREMENT', amount });
const decrement = (amount) => ({ type: 'DECREMENT', amount });

Reducers

Reducers specify how the state should change in response to actions:

const counterReducer = (state, action) => {
    switch (action.type) {
        case 'INCREMENT':
            return { ...state, count: state.count + action.amount };
        case 'DECREMENT':
            return { ...state, count: state.count - action.amount };
        default:
            return state;
    }
};

Selectors

Selectors allow you to retrieve specific parts of the state:

const selectCount = (state) => state.count;

Dispatching Actions

Dispatch actions to modify the state:

store.dispatch(increment(5));
store.dispatch(decrement(2));

Examples

For more detailed examples and use cases, please check the examples folder.

Contributing

We welcome contributions! If you'd like to contribute to YASM, please follow our contribution guidelines.

License

YASM is licensed under the MIT License. See the LICENSE file for details.


We hope YASM proves to be a valuable addition to your React projects. If you have any questions or encounter issues, please feel free to reach out to our community or open an issue on our GitHub repository. Happy coding!