# react-hook-use-cta

> A React hook for managing complex state with custom actions, history tracking, and type safety.

Latest version **2.3.2** (published 2025-01-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-hook-use-cta
pnpm add react-hook-use-cta
yarn add react-hook-use-cta
bun add react-hook-use-cta
```

## Health

**Score 60/100 (C)** — status: stable.

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

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 2.3.2 |
| Published | 2025-01-17 |
| First published | 2024-03-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 417.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 0 |
| Author | Rafael De León |
| Maintainers | rafde |
| Keywords | hooks, hook, management, manager, react, reducer, state, store, typescript |

## Links

- npm: https://www.npmjs.com/package/react-hook-use-cta
- Repository: https://github.com/rafde/react-hook-use-cta
- Homepage: https://rafde.github.io/react-hook-use-cta
- Issues: https://github.com/rafde/react-hook-use-cta/issues
- npm.io page: https://npm.io/package/react-hook-use-cta

## Dependencies (1)

- [fast-equals](https://npm.io/package/fast-equals.md) ^5.0.1

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

- 2.3.2 (latest) — 2025-01-17
- 2.3.1 — 2025-01-13
- 2.3.0 — 2025-01-13
- 2.2.1 — 2025-01-07
- 2.2.0 — 2025-01-06
- 2.1.1 — 2025-01-05
- 2.0.4 — 2025-01-01
- 2.0.3 — 2024-12-26
- 2.0.2 — 2024-12-26
- 2.0.1 — 2024-12-26
- 2.0.0 — 2024-12-26
- 2.0.0-pre.4 — 2024-12-24
- 2.0.0-pre.3 — 2024-12-16
- 2.0.0-pre.2 — 2024-12-16
- 2.0.0-pre.1 — 2024-12-04
- … 11 more at https://npm.io/package/react-hook-use-cta/versions

## README

# react-hook-use-cta: useCTA (use Call To Action)

[![NPM License](https://img.shields.io/npm/l/react-hook-use-cta)](/LICENSE)
[![NPM Version](https://img.shields.io/npm/v/react-hook-use-cta)](https://www.npmjs.com/package/react-hook-use-cta)
[![JSR Version](https://img.shields.io/jsr/v/%40rafde/react-hook-use-cta)](https://jsr.io/@rafde/react-hook-use-cta)
![Test](https://github.com/rafde/react-hook-use-cta/actions/workflows/test.yml/badge.svg)
![Lines](./site/public/badges/coverage-lines.svg)

Read full document for `react-hook-use-cta` on [documentation website](https://rafde.github.io/react-hook-use-cta)

## Install

```bash
npm i react-hook-use-cta
```

```bash
yarn add react-hook-use-cta
```

```bash
deno add jsr:@rafde/react-hook-use-cta
```

## useCTA

```tsx
import { useCTA, } from 'react-hook-use-cta';
```

```tsx
const [
	history,
	dispatch
] = useCTA({
	initial: {
		value: 0,
	},
});
```

## createCTA

```tsx
import { createCTA, } from 'react-hook-use-cta';

const [
	history,
	dispatch
] = createCTA({
	initial: {
		value: 0,
	},
});
```


## createCTAContext

```tsx
import { createCTAContext, } from 'react-hook-use-cta';

const context = createCTAContext({
	initial: {
		value: 0,
	},
});

export const CTAProvider = context.CTAProvider;
export const useCTAHistoryContext = context.useCTAHistoryContext;
export const useCTADispatchContext = context.useCTADispatchContext;
```

## createCTASelector

```tsx
import { createCTASelector, } from 'react-hook-use-cta';

export const useCTASelector = createCTASelector({
	initial: {
		value: 0,
	},
});
```

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