interweave icon indicating copy to clipboard operation
interweave copied to clipboard

React JSX Support

Open Lexpeee opened this issue 1 year ago • 3 comments

Hello! I'm not entirely sure if this has been raised before or asked, or maybe this question might seem of a basic one, but I just want to ask if there's any support for React JSX elements. So far we are able to pass down HTML elements through content prop, but I was wondering if we can pass down React JSX also. Wanting to parse react components also. Still currently new to the library.

Lexpeee avatar Apr 25 '23 19:04 Lexpeee

@Lexpeee It's been years since I've worked on this, but it should be possible with transform and messing with the configs. Here's the code: https://github.com/milesj/interweave/blob/master/packages/core/src/Parser.ts#L457

milesj avatar Apr 25 '23 19:04 milesj

Cool! I'll give it a try

Lexpeee avatar Apr 25 '23 19:04 Lexpeee

it should be possible with transform and messing with the configs.

@milesj JSX can contain JS code, so @Lexpeee may need https://github.com/TroyAlford/react-jsx-parser .

TechQuery avatar Jul 22 '24 16:07 TechQuery