@lamstack/react-core
v0.1.0
Published
Shared internal hooks used across lamstack React packages.
Readme
@lamstack/react-core
Shared hooks used internally by @lamstack/react-* packages. Not feature-specific — usable
standalone in any React 18+ project.
Docs: omnireact-six.vercel.app
Install
pnpm add @lamstack/react-coreExports
| Export | Description |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| useEventCallback(fn) | Returns a stable function reference that always calls the latest fn, without becoming a stale closure. Useful for passing callbacks to memoized children. |
| useNonNullableContext(context) | Reads a React.Context<T \| null> and throws if the value is null (i.e. no provider is mounted), instead of returning null silently. |
| useIsomorphicLayoutEffect | useLayoutEffect on the client, useEffect on the server — avoids the SSR warning from calling useLayoutEffect outside the browser. |
import {
useEventCallback,
useNonNullableContext,
useIsomorphicLayoutEffect,
} from '@lamstack/react-core';License
MIT
