# react-extended-state

> A simple react provider and hook implementation to allow for state management

Latest version **1.0.11** (published 2022-08-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-extended-state
pnpm add react-extended-state
yarn add react-extended-state
bun add react-extended-state
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2022-08-01 |
| First published | 2021-02-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 26.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Filipe Pomar |
| Maintainers | filipomar |
| Keywords | react, state, hooks, hook, redux, render |

## Links

- npm: https://www.npmjs.com/package/react-extended-state
- Repository: https://github.com/filipomar/react-extended-state
- Homepage: https://github.com/filipomar/react-extended-state#readme
- Issues: https://github.com/filipomar/react-extended-state/issues
- npm.io page: https://npm.io/package/react-extended-state

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.11 (latest) — 2022-08-01
- 1.0.10 — 2022-07-01
- 1.0.9 — 2022-06-16
- 1.0.8 — 2022-04-22
- 1.0.7 — 2022-04-22
- 1.0.6 — 2021-06-19
- 1.0.5 — 2021-06-17
- 1.0.4 — 2021-06-14
- 1.0.3 — 2021-05-08
- 1.0.2 — 2021-04-20
- 1.0.1 — 2021-02-22
- 1.0.0 — 2021-02-21

## README

# react-extended-state

Sometimes `React.useState` and `React.useReducer` are not enough.<br />
Sometimes you need to have a complex object and still be concerned about speed of your react components on updates.<br />
Dont want to shell out for `redux`? Actions are too much or confusing for you?<br />
Then this is a perfect solution for you! A simple react provider and hook implementation to allow for state management of complex objects.<br />

---

### Quick overview:

-   It is light
-   It has type checking at its core
-   Easy setup (under 5 lines)
-   No more useless renders!
-   Re-render filtering from the generated value
-   Scope dependencies

Usage:

```tsx
import React, { FC } from 'react';
import { render } from 'react-dom';
import { createExtendedState } from 'react-extended-state';

/**
 * This will be destructured, so be careful of what the top state is
 **/
type State = Readonly<{ name: string }>;

const { Provider, useExtendedState, useExtendedStateDispatcher } = createExtendedState<State>();

const App: FC = () => {
    const name = useExtendedState((s) => s.name);
    const dispatch = useExtendedStateDispatcher();

    return (
        <div>
            <label>
                Name:
                {name}
            </label>
            <input type="text" value={name} onChange={(e) => dispatch({ name: e.target.value })} />
        </div>
    );
};

render(
    <Provider value={{ name: '' }}>
        <App />
    </Provider>,
    document.querySelector('#root')
);
```

### LICENSE

MIT

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