Skip to main content

Getting started

On this page, you'll find general information about stocked.

Motivation

If you need to share state between your components, you'll face the performance issue. Saving all your app state into context isn't good solution, because changing value causes whole app rerender.

stocked adds a little functionality for handling global state. Changing this state not rerenders all your app, it rerenders only components, which use it.

Pro tip!

You can highlight updates when component render with React developer tools.

Inspiration

This library was inspired by the speed and greatness of Recoil.

Installation

Stocked is available from NPM or Yarn.

npm install stocked

Examples

The following examples will help you understand the essence of this library.

Simplicity

You don't need to have any additional deep knowledge of React to start using stocked.

Using stocked is as simple as using the useState hook in React.

Performance

This is an example todo-list app. It shows, how you can easily create performant apps with stocked.

You can add hunderds of todos at the same time, without drammatic decrease of performance. Try it out by entering the title of new todo and count.