Skip to content
Proyectos

Acerca de

Use Svelte components inside a React app

Desarrollo web y de aplicaciones

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

react-svelte

Use Svelte components inside React apps.

import { render } from 'react-dom';
import SvelteComponent from 'react-svelte';
import Widget from './Widget.html';

function MyReactApp(props) {
	return (
		<div>
			<p>this is a Svelte component inside a React app:</p>
			<SvelteComponent this={Widget} {...props}/>
		</div>
	)
}

render(<MyReactApp/>, document.querySelector('main'));

Demo here, source code for the demo here.

Why not just compile Svelte components to custom elements?

Because React's support for custom elements is somewhat lacking.

Limitations

This is a fairly basic integration, some things don't currently work and possibly never will:

  • the value of this is fixed; changing it after the initial render will have no effect
  • you can't use <slot>

License

LIL

Explorar proyectos relacionados

Cargando…