useSvelte

A React hook for loading Svelte components.

Example

Pass some Svelte code to useSvelte(), and it returns a ref suitable for binding an element.

import { useSvelte } from 'use-svelte-hook'

export function MyComponent() {
  const ref = useSvelte(`<p>{123}</p>`)

  return (
    <div ref={ref}/>
  )
}

License

MIT

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes