1.0.1 • Published 4 years ago

svelte-convert v1.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
4 years ago

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

License

MIT © EGOIST (Kevin Titor)