reasonml / reason

Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems
http://reasonml.github.io
MIT License
10.14k stars 428 forks source link

Support for "string" [@JSX] #2729

Closed davesnx closed 2 months ago

davesnx commented 11 months ago

We could tag strings with the JSX attribute and run it thought a "Reason.text" or similar application where ppxes can override it. Useful to remove React.string or Jsx.text when is a Pexp_constant (Pconst_string _)

"asdasdfasdf" [@JSX]

Same as we do for the fragments, where we tag lists.

andreypopp commented 11 months ago

I think this can be implement on ppx level w/o any [@JSX] attributes attached to the string literals — just need to wrap string literals which are immediate children of JSX elements.

anmonteiro commented 11 months ago

Agreed, I've relayed this to Dave privately and I'm working on a PoC to showcase this.