Liking cljdoc? Tell your friends :D

io.factorhouse.hsx.core


componentclj/smacro

(component display-name component-f)

Macro used to create a named Hsx component:

(def c (component :MyComponent (constantly [:div "Hello world"])))

Macro used to create a named Hsx component:

(def c (component :MyComponent (constantly [:div "Hello world"])))
sourceraw docstring

create-elementcljs

(create-element this)

Like react/createElement, but takes in some HSX hiccup and returns a React element.

Generally called at the root of your application, where you render your UI:

(defonce root
  (createRoot (.getElementById js/document "app")))

(defn init []
  (.render root (hsx/create-element [:div "Hello world!"])))
Like react/createElement, but takes in some HSX hiccup and returns a React element.

Generally called at the root of your application, where you render your UI:

```clojure
(defonce root
  (createRoot (.getElementById js/document "app")))

(defn init []
  (.render root (hsx/create-element [:div "Hello world!"])))
```
sourceraw docstring

ERROR-HANDLERcljs

source

handle-errorcljsmultimethod

source

memo-clear!cljs

(memo-clear!)

Resets the component cache. Useful to call in dev after hot reloading.

Resets the component cache. Useful to call in dev after hot reloading.
sourceraw docstring

reactify-componentcljs

(reactify-component comp)
(reactify-component comp props-deserialization-fn)

Returns a React Function component that can be called outside a HSX context.

This function is similar to reagent.core/reactify-component.

Requires that the HSX component accept everything in a single props map, including its children.

Second argument (optional): the props deserialization function. By default, is a shallow js->cljs.

(defn exported [props]
  [:div "Hi, " (:name props)])

(def react-comp (reactify-component exported))

(defn could-be-jsx []
 (react/createElement react-comp #js {:name "world"}))
Returns a React Function component that can be called outside a HSX context.

 This function is similar to reagent.core/reactify-component.

 Requires that the HSX component accept everything in a single props map, including its children.

 Second argument (optional): the props deserialization function. By default, is a shallow js->cljs.

 ```clojure
 (defn exported [props]
   [:div "Hi, " (:name props)])

(def react-comp (reactify-component exported))

(defn could-be-jsx []
  (react/createElement react-comp #js {:name "world"}))
 ```
sourceraw docstring

USE_MEMOcljs

source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close