import { useCallback } from 'react'; export const useSlug = () => { const slugify = useCallback((text: string) => { return text .toString() .toLowerCase() .trim() .replace(/\s+/g, '-') // Replace spaces with - .replace(/&/g, '-and-') // Replace & with 'and' .replace(/[^\w-]+/g, '') // Remove all non-word chars .replace(/--+/g, '-'); // Replace multiple - with single - }, []); return { slugify }; };