# react-component-updater

> Forcibly re-render a component from anywhere through React hooks.

Latest version **1.0.7** (published 2022-09-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-component-updater
pnpm add react-component-updater
yarn add react-component-updater
bun add react-component-updater
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2022-09-28 |
| First published | 2021-03-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Grant Gryczan |
| Maintainers | grantgryczan |
| Keywords | react, hook, hooks, update, updater, component, components, re, render, re-render, rerender, force, forcibly, outside |

## Links

- npm: https://www.npmjs.com/package/react-component-updater
- Repository: https://github.com/GrantGryczan/react-component-updater
- Homepage: https://github.com/GrantGryczan/react-component-updater#readme
- Issues: https://github.com/GrantGryczan/react-component-updater/issues
- npm.io page: https://npm.io/package/react-component-updater

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.7 (latest) — 2022-09-28
- 1.0.6 — 2021-08-04
- 1.0.5 — 2021-04-16
- 1.0.4 — 2021-03-24
- 1.0.3 — 2021-03-20
- 1.0.2 — 2021-03-18
- 1.0.1 — 2021-03-14
- 1.0.0 — 2021-03-14

## README

# React Component Updater

This package provides the ability to forcibly re-render a component from anywhere through React hooks.

* No extra files or React components required
* No dependencies but React itself
* Very small bundle size (< 1 kB)

# Usage

## Create the updater

```ts
import createUpdater from 'react-component-updater';

const [useMyComponentUpdater, updateMyComponent] = createUpdater();
```

## Use the updater

```ts
const MyComponent = () => {
	useMyComponentUpdater();

	// ...
};
```

With the above code, whenever `updateMyComponent` is called, `MyComponent` will be re-rendered.

## Update the component

The update function can be called **inside or outside** a React component.

```ts
updateMyComponent();
```

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