Fork me on GitHub

Done! šŸ˜„


Also done šŸ™‚ thanks for taking the time to work on this


thank clojurists together for funding the time šŸ˜‰

ā¤ļø 16
thanks2 4
Michaƫl Salihi20:08:24

Hi eveybody ! Is there a difference (maybe performance ?) to require react-native like this

  (:require [reagent.core :as r :refer [atom]]))

(def ReactNative (js/require "react-native"))

(def text (r/adapt-react-class (.-Text ReactNative)))

(defn app-root
  [text "Hello World!"])


Michaƫl Salihi20:08:21

Instead like this

  (:require [reagent.core :as r :refer [atom]]
            ["react-native" :as rn :erfer [Text]]))

(defn app-root
  [:> Text "Hello World!"])



no difference in performance no. otherwise the only difference is the amount of code

Michaƫl Salihi20:08:49

Perfect, thx @thheller ! Yes I prefer the second one and surprise to often see

(def ReactNative (js/require "react-native"))

(def app-registry (.-AppRegistry ReactNative))
(def text (r/adapt-react-class (.-Text ReactNative)))
(def view (r/adapt-react-class (.-View ReactNative)))
(def image (r/adapt-react-class (.-Image ReactNative)))
(def touchable-highlight (r/adapt-react-class (.-TouchableHighlight ReactNative)))
Like in Re-natal template


dunno how well the second version is supported outside of shadow-cljs


but support for that came after re-natal came out so it probably just wasn't updated

Michaƫl Salihi21:08:41

I just tried the second version with re-natal/figwheel and it works well. Maybe I'll propose a pull request.

Michaƫl Salihi21:08:49

Notice : I do not test to build app right now