FoundryKit

Integration

How Hooks supports FoundryKit UI packages.

Integration

Hooks is useful on its own, but it is especially valuable when you want the same behaviour contracts used by Components without importing the full UI layer.

import { useDebouncedValue, useLocalStorage } from '@foundrykit/hooks';

export function SearchState({ query }) {
  const debouncedQuery = useDebouncedValue(query, 300);
  const [recentQuery] = useLocalStorage('recent-query', '');

  return <pre>{JSON.stringify({ debouncedQuery, recentQuery })}</pre>;
}

When you are already using Components, prefer those exports for the packaged UI and use Hooks directly for app-specific logic.

On this page