# use-connect-render

> import { useConnectRender } from 'use-connect-render'

Latest version **0.0.34** (published 2022-08-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install use-connect-render
pnpm add use-connect-render
yarn add use-connect-render
bun add use-connect-render
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.34 |
| Published | 2022-08-12 |
| First published | 2021-06-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 30.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Phuc Sang |
| Maintainers | spt0hc |
| Keywords | react hook, hook state management, state management without redux, react render, connect render, react connect render, use connect render, react hook render, redux with hook, redux with nextjs |

## Links

- npm: https://www.npmjs.com/package/use-connect-render
- Repository: https://github.com/phucsang0spt/use-connect-render
- Homepage: https://github.com/phucsang0spt/use-connect-render#readme
- Issues: https://github.com/phucsang0spt/use-connect-render/issues
- npm.io page: https://npm.io/package/use-connect-render

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21

## 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

- 0.0.34 (latest) — 2022-08-12
- 0.0.33 — 2022-08-02
- 0.0.32 — 2022-03-29
- 0.0.31 — 2022-03-04
- 0.0.30 — 2022-03-04
- 0.0.29 — 2022-01-27
- 0.0.28 — 2022-01-21
- 0.0.27 — 2021-10-11
- 0.0.26 — 2021-10-11
- 0.0.25 — 2021-10-11
- 0.0.24 — 2021-10-10
- 0.0.23 — 2021-10-04
- 0.0.22 — 2021-10-04
- 0.0.2-1.4 — 2021-10-04
- 0.0.2-1.3 — 2021-10-04
- … 22 more at https://npm.io/package/use-connect-render/versions

## README

import { useConnectRender } from 'use-connect-render'

#### Example 1:

```
function CompA() {
   const { push } =  useConnectRender('my-counter', { c: 0, started : false });

   return (
        <button onClick={()=> {
            push('c', prev => prev + 1);
            push('started', true)
        }}>
           Click me
        </button>
   );
}

function CompB() {
   const { listen } =  useConnectRender('my-counter', { c: 0, started : false });

   const [counter, started] = listen('c','started');
   return (
        <div>
          started : {started}
          my count: {counter}
        </div>
   );
}
```

#### Example 2:

```
function CompA() {
   const { push, getCurrent } =  useConnectRender('my-counter', { c: 0 });

   const count = useCallback(()=>{
       const curr = getCurrent('c')[0];
       push('c', curr + 1);
   },[push, getCurrent]);

   return (
        <button onClick={count}>
           Click me
        </button>
   );
}

function CompB() {
   const { listen } =  useConnectRender('my-counter', { c: 0 });

   const [counter] = listen('c');
   return (
        <div>
          my count: {counter}
        </div>
   );
}
```

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