Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

JSX preserve mode with @JSX attribute #613

Closed
mununki opened this issue Jul 17, 2022 · 2 comments
Closed

JSX preserve mode with @JSX attribute #613

mununki opened this issue Jul 17, 2022 · 2 comments
Labels

Comments

@mununki
Copy link
Member

mununki commented Jul 17, 2022

It is found that the attribute @JSX makes the printer function preserve the JSX expression. #539 (comment)
Changing the JSX PPX to keep the @JSX attribute after transformation, it prints as below. The checking of the call expression should be turned off by the way. It can be used in the compiler emitter to print the JSX in preserve mode.

// expected
let make = ({msg}) => ReactDOMRe.createDOMElementVariadic("div", [{msg->React.string}])

// generated
let make = ({msg}) => <ReactDOMRe.createDOMElementVariadic>  </ReactDOMRe.createDOMElementVariadic>
@mununki
Copy link
Member Author

mununki commented Aug 3, 2022

The related functions to print JSX need to be updated as per changes by JSX V4, such as printJsxExpression, printJsxName. They look working with only V3.
Plus, those functions can be used to preserve the JSX in the compiler.

@stale
Copy link

stale bot commented May 28, 2023

The rescript-lang/syntax repo is obsolete and will be archived soon. If this issue is still relevant, please reopen in the compiler repo (https://github.com/rescript-lang/rescript-compiler) or comment here to ask for it to be moved. Thank you for your contributions.

@stale stale bot added the stale label May 28, 2023
@stale stale bot closed this as completed Jun 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant