pitch-io / uix

Idiomatic ClojureScript interface to modern React.js
https://github.com/pitch-io/uix?tab=readme-ov-file#docs
Eclipse Public License 2.0
359 stars 21 forks source link

Ability to configure/replace react/createElement #136

Closed cj-price closed 9 months ago

cj-price commented 9 months ago

Is your feature request related to a problem? Please describe. I would like to use :css within my uix components.

Describe the solution you'd like Allow the user to do something like this:

(reset! *react-create-element-fn* emotion/jsx)

-or-

(uix.dom/render-root ($ app) root {:react-create-element-fn emotion/jsx})

Describe alternatives you've considered I am not sure if shadow-cljs has the ability to redef react/createElement but that is something I would like to look into.

Additional context Reagent's compiler allows you to do this: https://github.com/reagent-project/reagent/blob/7d8cdad9037ce952ba18868e9a5eaf3fd1c8023e/examples/emotion/src/example/compiler.cljs#L35

roman01la commented 9 months ago

There are multiple options. You can do (set! react/createElement your-create-element) or create a wrapper macro for $ macro.