Client Hooks in Svelte

From the SvelteKit cheat sheet ยท Hooks ยท verified Nov 2026

Client Hooks

Client-side navigation and error handling

javascript
// src/hooks.client.js
export function handleError({ kind, error, event }) {
  if (kind !== 'unknown') return error;

  console.error(error);
  return { message: 'Something went wrong' };
}
โŒ Client-side error handling and reporting
๐Ÿ“Š Performance monitoring
๐Ÿ’พ Service worker for offline support
๐Ÿ”„ reroute in src/hooks.js maps URLs to routes

Continue with SvelteKit

Save the full cheat sheet or work through every related task.

More Svelte tasks

Back to the full SvelteKit cheat sheet