What is it?

Redux Zero is a lightweight state container based on Redux with a single store and no reducers.

Written in TypeScript, is very small and has bindings for Preact, React, Svelte and Vue.

Motivation

We all love Redux, but for some cases, Redux is way too much. Maybe you don’t want to add all of that boilerplate to your project. Or maybe the learning curve of Redux is too steep and you just want something simpler to work with.

That's where Redux Zero comes in!

How Redux Zero is different?

The name “Redux Zero” was chosen because of two important characteristics of the library:

  • No reducers (or zero reducers)
  • It’s lightweight (or zero calories)

That’s why the library is smaller than 1kb (gzip) and the learning curve is so low.

You don’t have to learn about dispatchers and reducers, just add some actions and call them from your components!

Inspiration

Redux Zero was based on this gist by @developit.

Installation

npm install --save redux-zero

// or

yarn add redux-zero

Usage

Import the main package and the binding to one of the supported frameworks:

// the store
import createStore from 'redux-zero';

// react bindings
import { Provider, connect } from 'redux-zero/react';

// preact bindings
import { Provider, Connect } from 'redux-zero/preact';

// svelte bindings
import { connect, getActions } from 'redux-zero/svelte';

// vue bindings
import { connect } from 'redux-zero/vue';

Alternatively, you can use it through UMD:

<!-- the store -->
<script src="https://unpkg.com/redux-zero/dist/redux-zero.min.js"></script>

<!-- for preact -->
<script src="https://unpkg.com/redux-zero/preact/index.min.js"></script>

<!-- for react -->
<script src="https://unpkg.com/redux-zero/react/index.min.js"></script>

<!-- for svelte -->
<script src="https://unpkg.com/redux-zero/svelte/index.min.js"></script>

<!-- for vue -->
<script src="https://unpkg.com/redux-zero/vue/index.min.js"></script>

See the API Reference or jump to the Examples to see how simple it is to use Redux Zero.

results matching ""

    No results matching ""