Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tinysaga

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinysaga

Simple state and logic management library for modern React apps.

  • 2.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

tinysaga

Simple state and logic management library for modern React apps.

Installation

$ yarn add tinysaga

Comes with TypeScript typings out of the box, as well as ESM support and tree shaking.

Overview

Tinysaga is the no-frills state management solution for modern React apps. Users of Redux, React Redux, and Redux-Saga will be familiar with Tinysaga's constructs and ideas.

Out of the box, Tinysaga includes the following pieces:

  • A Store class which allows the user to update state and subscribe to changes. Its view-facing API is identical to that of Redux.
  • React integration via a Store <Provider> and familiar useDispatch() and useSelector() hooks.
  • Logic handling infrastructure via familiar Channel and put()/on() patterns.
  • Builtin strong Action typing on all of the above to make dispatching and handling actions more fluent in TypeScript.

Comparison to Redux-Saga

Redux-Saga is a great library which allows applications to manage the complex state updates and side effects that happen in many React-Redux applications. It is a crucial part of the current frontend software stack.

However, the library itself is quite complex, which can cause problems in the following ways:

  1. Developers onboarding into a Saga-based codebase may need to understand the Saga fork and threading model pretty deeply in order to contribute to the code. This creates cognitive overhead for even the best developers.
  2. The effect model can be surprising to unravel. For example, sending a callback to external code becomes a lot more complex as developers need to reason about how to invoke effects from within the callback.
  3. The syntax itself can be challenging and unfamiliar, such as yield and yield*, or why you would want to yield take inside of a while (true) loop.
  4. The code can be very hard to debug, especially in modern compile-to-ES6 toolchains where the generators become obfuscated. Stepping through code can be a chore, and profiling code through many layers of effect realization can be a nightmare.

Tinysaga supports most of the common put() and on() workflows, along with take() and takeAdvanced() sugar, without necessitating generators through your codebase. This allows the programmer to implement his or her logic through the tried-and-true event bus architecture, with the help of well-understood plain JavaScript utilities like Lodash for debouncing, throttling, and cancellation, without opening your organization up to the long-term tooling and execution risk that comes with newer technologies like generators.

License

MIT

Keywords

FAQs

Package last updated on 04 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc