# @rematch/core

> A Redux Framework

Latest version **2.2.0** (published 2021-11-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rematch/core
pnpm add @rematch/core
yarn add @rematch/core
bun add @rematch/core
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2021-11-09 |
| First published | 2017-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 304.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8395 |
| Maintainers | shmck, blairbodnar, semoal |
| Keywords | @rematch, rematch, redux, state management, javascript |

## Links

- npm: https://www.npmjs.com/package/@rematch/core
- Repository: https://github.com/rematch/rematch
- Homepage: https://rematchjs.org
- Issues: https://github.com/rematch/rematch/issues
- npm.io page: https://npm.io/package/@rematch/core

## Alternatives

- [@reckona/mreact-store](https://npm.io/package/@reckona/mreact-store.md) — 976 weekly downloads
- [regular-state](https://npm.io/package/regular-state.md) — 410 weekly downloads
- [@pacote/flux-actions](https://npm.io/package/@pacote/flux-actions.md) — 65 weekly downloads
- [@pilotlab/lux-debug](https://npm.io/package/@pilotlab/lux-debug.md) — 39 weekly downloads
- [vue-persist-state](https://npm.io/package/vue-persist-state.md) — 19 weekly downloads

## Recent versions

- 2.2.0 (latest) — 2021-11-09
- 2.0.0-next.10 (next) — 2020-12-27
- 1.0.0-beta.5 (beta) — 2018-06-28
- 1.0.0-alpha.8 (alpha) — 2018-06-10
- 2.1.1 — 2021-10-11
- 2.1.0 — 2021-08-13
- 2.0.1 — 2021-02-23
- 2.0.0 — 2021-01-31
- 2.0.0-next.9 — 2020-12-22
- 2.0.0-next.8 — 2020-12-21
- 2.0.0-next.7 — 2020-11-30
- 2.0.0-next.6 — 2020-10-08
- 2.0.0-next.5 — 2020-09-07
- 2.0.0-next.4 — 2020-08-26
- 2.0.0-next.3 — 2020-08-26
- … 61 more at https://npm.io/package/@rematch/core/versions

## README

<div align="center">
<h1>Rematch<sub>js</sub></h1>

Rematch is Redux best practices without the boilerplate. No more action types, action creators, switch statements or thunks in less than 1.4 kilobytes.

<hr />

[![Chat on Discord](https://img.shields.io/badge/discord-rematch-purple.svg?logo=discord&style=flat-square)](https://discord.gg/zMzsMGvEHk) ![Rematch CI](https://github.com/rematch/rematch/workflows/Rematch%20CI/badge.svg?branch=main) [![Bundle size](https://img.shields.io/bundlephobia/minzip/@rematch/core?style=flat-square)](https://img.shields.io/badge/bundlesize-~5kb-brightgreen.svg?style=flat-square) [![File size](https://img.shields.io/badge/dependencies-redux-brightgreen.svg?style=flat-square)](https://img.shields.io/badge/dependencies-redux-brightgreen.svg?style=flat-square) [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg?style=flat-square)](https://lerna.js.org/) [![https://img.shields.io/lgtm/grade/javascript/github/rematch/rematch?logo=typescript](https://img.shields.io/lgtm/grade/javascript/github/rematch/rematch?logo=typescript)](https://lgtm.com/projects/g/rematch/rematch?mode=list)  [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/from-referrer/)


[**Documentation**](https://rematchjs.org)  · [**Quickstart**](https://rematchjs.org/docs/getting-started/installation) · [**Examples**](https://rematchjs.org/examples/) · [**Contribute**](./CONTRIBUTING.md) · [**Licence**](#licence)

</div>

## Features

Redux is an amazing state management tool, supported by a healthy middleware ecosystem and excellent devtools.
Rematch builds upon Redux by reducing boilerplate and enforcing best practices. It provides the following features:

- No configuration needed
- Reduces Redux boilerplate
- Built-in side-effects support
- [React Devtools](https://github.com/facebook/react/tree/master/packages/react-devtools) support
- TypeScript support
- Supports dynamically adding reducers
- Supports hot-reloading
- Allows to create multiple stores
- Supports React Native
- Extendable with plugins
- Many plugins available out of the box:
    - for persisting data with [redux-persist](https://github.com/rt2zz/redux-persist)
    - for wrapping state with [immer.js](https://github.com/immerjs/immer)
    - for creating selectors with [reselect](https://github.com/reduxjs/reselect)
    - ...and others

## Are you ready to use Rematch?

In a few lines you can get easily asynchronous calls to an external API and data stored globally. It's amazing, with Redux you will needs tons of boilerplate, libraries and extra configuration.

```ts
type PlayersState = {
    players: PlayerModel[]
}

export const players = createModel<RootModel>()({
    state: {
        players: [],
    } as PlayersState,
    reducers: {
        SET_PLAYERS: (state: PlayersState, players: PlayerModel[]) => {
            return {
                ...state,
                players,
            }
        },
    },
    effects: (dispatch) => {
        const { players } = dispatch
        return {
            async getPlayers(): Promise<any> {
                let response = await fetch('https://www.balldontlie.io/api/v1/players')
                let { data }: { data: PlayerModel[] } = await response.json()
                players.SET_PLAYERS(data)
            },
        }
    },
})
```

Check it out, [right now!](https://rematchjs.org/)

## Redux vs Rematch

|                           | Redux  | Rematch      |
| :------------------------ | :----: | :----------: |
| simple setup ‎            |        | ‎✔           |
| less boilerplate          |        | ‎✔           |
| readability               |        | ‎✔           |
| configurable              | ‎   ✔  | ‎✔           |
| redux devtools            |   ‎✔   |       ‎✔     |
| generated action creators | ‎      |       ‎✔     |
| async                     | thunks | ‎async/await |

## Migrate From Redux

Migrating from Redux to Rematch may only involve minor changes to your state management, and no necessary changes to your view logic. See the [migration reference](https://rematchjs.org/docs/migrating-from-redux-to-rematch) for the details.

## Composable Plugins

Rematch and its internals are all built upon a plugin pipeline. As a result, developers can make complex custom plugins that modify the setup or add data models, often without requiring any changes to Rematch itself. See the [plugins](https://rematchjs.org/docs/plugins) developed by the Rematch team or the [API for creating plugins](https://rematchjs.org/docs/api-reference/plugins).


## Contact & Support

- Create a [GitHub issue](https://github.com/rematch/rematch/issues) for bug reports, feature requests, or questions
- Add a ⭐️ [star on GitHub](https://github.com/rematch/rematch) to support the project!

### Contributors

Thank you to all the people who have already contributed to rematch!
<a href="https://github.com/rematch/rematch/graphs/contributors">
  <img src="https://contributors-img.web.app/image?repo=rematch/rematch" />
</a>

Made with [contributors-img](https://contributors-img.web.app).

## Licence

This project is licensed under the [MIT license](https://github.com/rematch/rematch/blob/main/LICENSE).

---
_Source: https://npm.io/package/@rematch/core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
