svelte-convert Svelte Themes

Svelte Convert

Convert Svelte component to Vue or React component, with SSR support.

Svelte-Convert

Convert Svelte component to Vue or React component, with SSR support.

Why

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.

Install

yarn add svelte-convert

Usage

React

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} />
}

Vue

<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:

License

MIT © EGOIST (Kevin Titor)

Top categories

Loading Svelte Themes