Thanks to visit codestin.com
Credit goes to github.com

Skip to content

laststance/laststance-hooks

Repository files navigation

Laststance Hooks

Open React hooks distributed as a shadcn custom registry.

The first registry item, lifecycle-effects, installs explicit React 19+ effect hooks into your project's configured hooks directory.

Install

Install directly from the public registry item:

npx shadcn@latest add https://raw.githubusercontent.com/laststance/laststance-hooks/main/public/r/lifecycle-effects.json

Or register a namespace in components.json:

{
  "registries": {
    "@laststance-hooks": "https://raw.githubusercontent.com/laststance/laststance-hooks/main/public/r/{name}.json"
  }
}

Then install by name:

npx shadcn@latest add @laststance-hooks/lifecycle-effects

Before installing, inspect the exact code payload:

npx shadcn@latest view https://raw.githubusercontent.com/laststance/laststance-hooks/main/public/r/lifecycle-effects.json

Lifecycle Effects

lifecycle-effects adds:

  • useInitialEffect: mount-only effects.
  • useUpdateEffect: post-mount update effects, with empty deps rejected at the type level.
  • useUnmountEffect: unmount-only cleanup using React 19 useEffectEvent.
  • useRenderEffect: every render, or mount plus non-empty dependency changes.
  • useCycleEffect: a semantic alias for useEffect.

React 19+ is required because useUnmountEffect and useUpdateEffect use useEffectEvent to call the latest callback without forcing dependency churn.

Development

pnpm install
pnpm registry:build
pnpm registry:check
pnpm typecheck
pnpm validate

The generated registry item lives in public/r/lifecycle-effects.json. Review that JSON in pull requests because it is the exact payload consumed by the shadcn CLI.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors