jsx2json icon indicating copy to clipboard operation
jsx2json copied to clipboard

Parsing error for prop values of JSX

Open holloway opened this issue 5 years ago • 3 comments

I get parsing errors on code like,

<Radio label={<h1>hello</h1>}> children </Radio>

It's the prop values as JSX that causes it, so I tried useEval but that assumes JavaScript so the jsx2json parser fails on the < in <h1>

("SyntaxError: Unexpected token `<` at parseProps  jsx2json/jsx.parser.js:22:47 ).

just fyi... as I was hoping it would resolve recursively like children.

holloway avatar Apr 16 '19 07:04 holloway

Hello how did you end with this?

Hussseinkizz avatar Mar 22 '24 22:03 Hussseinkizz

I wrote https://www.npmjs.com/package/xml-zero-lexer and then gave up and switched to https://www.npmjs.com/package/sax-wasm. No idea if it handles this use-case though

holloway avatar Mar 25 '24 22:03 holloway

Hmm, I have no choice but stick to jsx2json, I want to use it in some framework am working on and I need something really lite and easy a bit that I can extend it, I think over time I will see if there's anything I could contribute towards jsx2json, why didn't you just made a pr with that feature by the way? it would have been great if possible!

Hussseinkizz avatar Mar 26 '24 06:03 Hussseinkizz