Skip to content

2.1.0

Latest
Compare
Choose a tag to compare
@bfanger bfanger released this 03 Feb 08:32

hooks()

hooks() utility is now signal based and synchronous (thanks to flushSync)

Usage:

<script lang="ts">
  const [count, setCount] = $derived.by(hooks(() => useState(0)));
</script>

<button onclick={() => setCount(count + 1)}>{count}</button>

reactify()

reactify() now has a similar api as sveltify() allowing converting multiple components at once:

import { reactify } from "svelte-preprocess-react";
import Button from "$lib/components/Button.svelte";

const svelte = reactify({ Button });

const App: React.FC = () => (
  <div className="app">
    <svelte.Button variant="primary" onclick={() => console.log("Hi")}>
      Say hi
    </svelte.Button>
  </div>
);

reactify() has also been improved for compatibility when when using the reactified component outside a SvelteKit app.