Seamlessly use React components inside a Svelte app
MIT License
Published by bfanger 5 days ago
Published by bfanger about 1 year ago
import sveltify from "svelte-preprocess-react/sveltify";
import { sveltify } from "svelte-preprocess-react";
import { sveltify } from "svelte-preprocess-react";
is supported.Published by bfanger over 1 year ago
<react:input />
#25Published by bfanger almost 2 years ago
#20 fix react key warning when using hooks
Published by bfanger almost 2 years ago
<react:Component />
in AST branches like inside {:else}, {:catch} blockPublished by bfanger about 2 years ago
Use import * as React from "react"
notation, this works for both bundled and native loaders.
( import { useState } from "react"
fails in certain conditions because react is not ESM)
Published by bfanger about 2 years ago
After updating to 0.10.0 you'll be getting a TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".svelte"
error when starting vite dev
.
Update the import in your svelte.config.js, change:
import preprocessReact from "svelte-preprocess-react";
into
import preprocessReact from "svelte-preprocess-react/preprocessReact";
This change allows importing the utilities directly from svelte-preprocess-react
, for example:
import { useStore } from "svelte-preprocess-react";
useReadable
to useStore
useWritable
(a writable store already has a set function)<react:Context.Provider {value} />