https://github.com/rafde/react-hook-use-cta
A React hook for managing complex state with custom actions, history tracking, and type safety.
https://github.com/rafde/react-hook-use-cta
hooks-api-react javascript-library react react-hooks reactjs typescript-react
Last synced: 4 months ago
JSON representation
A React hook for managing complex state with custom actions, history tracking, and type safety.
- Host: GitHub
- URL: https://github.com/rafde/react-hook-use-cta
- Owner: rafde
- License: mit
- Created: 2024-02-14T21:45:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-18T08:01:22.000Z (about 1 year ago)
- Last Synced: 2025-03-19T05:07:05.680Z (about 1 year ago)
- Topics: hooks-api-react, javascript-library, react, react-hooks, reactjs, typescript-react
- Language: TypeScript
- Homepage: https://rafde.github.io/react-hook-use-cta/
- Size: 1.99 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-hook-use-cta: useCTA (use Call To Action)
[](/LICENSE)
[](https://www.npmjs.com/package/react-hook-use-cta)
[](https://jsr.io/@rafde/react-hook-use-cta)


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,
},
});
```