bfanger / svelte-preprocess-react

Seamlessly use React components inside a Svelte app
MIT License
126 stars 6 forks source link

Improve VS Code support #1

Open bfanger opened 2 years ago

bfanger commented 2 years ago

Would be nice if the props and events would be typed

osmanium commented 1 year ago

Hi, first of all this lib is a saviour.

Related to issue you mentioned above, I'm trying to use new Fluent UI React v9 and a bit stuck on how to use in svelte.

<CompoundButton icon={< CompoundIcon />} secondaryContent="Secondary content"> Example </ CompoundButton> Icon is another react component and setting it gives an error "Unknown directive", and if I remove icon style is not applied...

By any chance, do you have any examples of how it can be used?

Thanks in advance!

bfanger commented 1 year ago

@osmanium You can't use JSX inside a *.svelte file (yet) #16

JSX is a simple transformation, the <CompoundIcon /> transforms into React.createElement(CompoundIcon, null) Try https://babeljs.io/repl for complexer JSX transformations.

I don't have examples of Fluent UI

The <react:CompoundButton icon={React.createElement(CompoundIcon, null)} >Example</react:CompoundButton> is valid syntax for inside a svelte file.