pesterhazy / recalcitrant

Reagent toolbox for building simple components
MIT License
18 stars 1 forks source link

Devcards example #4

Open Conaws opened 7 years ago

Conaws commented 7 years ago

You gave a great example during a breakout at Clojure remote of how to use this in devcards, posting example here for others

(defn ops [] (assert false) [:div "hey"])

(defcard oops (r/as-element [(fn [] [error-boundary [ops]])]) )

Conaws commented 7 years ago

This can be nicely wrapped in a util function

(defn wboundary [elem]
  (reagent/as-element [(fn [] [recalcitrant.core/error-boundary
                         elem])]))

(defn ops []
(assert false)
  [:div "hey"])

(defcard oopss
  (with-boundary [oops]))
pesterhazy commented 7 years ago

Looks good! Maybe it would be possible to contribute this back to devcards? Either by default or as a defcard-safe variant. What do you think?

I didn't see an issue in devcard's github. If we want to move this forward, I think a good first step would be to report the problem there.