Convert Svelte component to Vue or React component, with SSR support.
Svelte outputs light-weight JavaScript code, so you can use it to write framework agnostic component and then consume it in your React / Vue app.
yarn add svelte-convert
import { convert } from 'svelte-convert/react'
import SvelteCounter from './Counter.svelte'
// Convert the Svelte component to React Component
const Counter = convert(SvelteCounter)
export default () => {
return <Counter initialCount={2} />
}
<template>
<Counter :initialCount="2" />
</template>
<script>
import { convert } from 'svelte-convert/vue'
import SvelteCounter from './Counter.svelte'
export default {
components: {
Counter: convert(SvelteCounter)
}
}
</script>
You might also like:
MIT © EGOIST (Kevin Titor)