react-hook-use-cta
v2.3.2
Published
A React hook for managing complex state with custom actions, history tracking, and type safety.
Maintainers
Readme
react-hook-use-cta: useCTA (use Call To Action)
Read full document for react-hook-use-cta on documentation website
Install
npm i react-hook-use-ctayarn add react-hook-use-ctadeno add jsr:@rafde/react-hook-use-ctauseCTA
import { useCTA, } from 'react-hook-use-cta';const [
history,
dispatch
] = useCTA({
initial: {
value: 0,
},
});createCTA
import { createCTA, } from 'react-hook-use-cta';
const [
history,
dispatch
] = createCTA({
initial: {
value: 0,
},
});createCTAContext
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
import { createCTASelector, } from 'react-hook-use-cta';
export const useCTASelector = createCTASelector({
initial: {
value: 0,
},
});