All Projects → egoist → Svelte Convert

egoist / Svelte Convert

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

Programming Languages

typescript
32286 projects

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>

Related

You might also like:

License

MIT © EGOIST (Kevin Titor)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].