This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-07
Channels
- # beginners (95)
- # cider (131)
- # cljdoc (12)
- # cljsjs (2)
- # clojure (209)
- # clojure-dev (1)
- # clojure-italy (3)
- # clojure-nl (10)
- # clojure-russia (37)
- # clojure-spec (19)
- # clojure-uk (182)
- # clojurescript (136)
- # cursive (28)
- # datomic (28)
- # editors (55)
- # figwheel-main (1)
- # fulcro (36)
- # hyperfiddle (12)
- # jobs (1)
- # jobs-discuss (55)
- # luminus (1)
- # mount (1)
- # off-topic (28)
- # onyx (18)
- # reagent (17)
- # ring-swagger (4)
- # rum (14)
- # shadow-cljs (22)
- # spacemacs (15)
- # tools-deps (16)
- # vim (26)
Hi Channel, how would you handle flash messages with reagent? I think I might doin’ things wrong. My error messages (like: user already exists) are not rendered at all. Is there a resource to ses how it is done right, somewhere?
@mp747 by flash message you mean you want to show the massage for few secs and then make it disappear ?
@rnagpal I mean the session flash messages that have a livespan of exactly one request.
something like
(def component-error (reagent/ratom nil))
(defn component[]
[:div
(when @component-error [error-message @component-error] )
[:div ......]])
Thanks for your message 🙂 I do get that. My question is more: the error happened somewhere in the backend (e.g. a database error) and I want to show that to the user.
@mp747 there’s no built in mechanism like in rails or meteor. you’ll have to craft your own convention and return the error string
yeah. reagent is a purely front-end wrapper for React. it sounds like macchiato might be interesting to you? you'll want to hook into whatever your backend has support for flash messages
@lee.justin.m coming from Rails that is something, that I do miss, though. What would be the idiomatic way to do it in Clojure/Script? Are there any (up to date) resources on this?
@lilactown I started with Luminus and Compojure-api