Socket
Socket
Sign inDemoInstall

reusable

Package Overview
Dependencies
38
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    reusable

Reusable is a library for reusing state and business logic between components.


Version published
Weekly downloads
597
decreased by-19.43%
Maintainers
1
Install size
2.48 MB
Created
Weekly downloads
 

Readme

Source

What?!

Reusable is a library for reusing state and business logic between components.

Should I use this now?

This is a very early stage alpha If you want to start experimenting with it and share feedback - yes If you need it for a production app - no

Why?

Reusable provides a way for app-level state management, with a simple and clean API, inspired and based on React hooks API.

React hooks introduced new ways of thinking about state and side-effects inside components. Reusable is applying the same principals to app-level state-management by adopting the same API and the same concepts:

  • Separation of concerns
  • Reusability
  • Composability
  • Simplicity

While still providing the developers with structure and architecture with large-scale apps in mind.

Features

  • managing shareable state
  • handling side effects
  • memoization
  • reactive (subscription)

Design guidelines

  • immutability
  • reusability (duh)
  • performance
  • predictability
  • encapsulation (for shared libraries / lazy loading)
  • gradually adoptable

Documentation

https://reusablejs.github.io/reusable

Commonly asked questions

What about Context API?

Using Context API directly, introduces a few challenges. Deciding where in the component tree to put a certain Context is tricky, and also might change while building your app. It forces you to couple the data tree with the component tree, and creates artifically deeply nested component trees. Reusable tries to solve these issues by decoupling the reusable state from the component tree, and by providing other benefits, such as:

  • Time Travelling
  • Single Store
  • Compound Selectors
  • Structure

Is Reusable designed for large apps?

Reusable is built with large-scale apps in mind. This affected many of the considerations when designing the solution:

  • The benefits of a single store and immutable data
  • The ability to do code reuse using custom hooks to prevent code duplication
  • Supporting DevTools for better debugging & QA
  • Support lazy-loaded modules

Feedback:

https://goo.gl/forms/Jza0XsM7F3shvWhD2

What's missing:

  • Tests
  • DevTools
  • Docs
  • More Examples
    • lazy-loaded modules example
    • API requests
    • Keyed states
    • 3rd party
  • Time Travelling
  • TypeScript Support
  • Better error messages

FAQs

Last updated on 28 May 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc