This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-10
Channels
- # announcements (4)
- # asami (3)
- # babashka (49)
- # beginners (56)
- # chlorine-clover (42)
- # cider (13)
- # clara (3)
- # cljfx (14)
- # clojure (65)
- # clojure-australia (2)
- # clojure-dev (12)
- # clojure-europe (57)
- # clojure-italy (10)
- # clojure-nl (3)
- # clojure-spec (25)
- # clojure-uk (25)
- # clojuredesign-podcast (11)
- # clojurescript (78)
- # code-reviews (16)
- # community-development (3)
- # cursive (14)
- # datomic (16)
- # depstar (20)
- # emacs (3)
- # figwheel-main (2)
- # fulcro (33)
- # helix (16)
- # jackdaw (15)
- # kaocha (13)
- # leiningen (3)
- # malli (33)
- # reveal (10)
- # shadow-cljs (29)
- # spacemacs (10)
- # sql (13)
Curious how people are "handling" this:
(let [[error? set-error?] (hooks/use-state false)])
As set-error?
is kinda confusing of a name, as it implies it should be a boolean.flip-error?
:)
you can always create a use-error
hook which verifies it’s a boolean
I usually end up refactoring it anyway to a use-reducer anyway once it gets more complex so I don’t really sweat it
set-error!
and error?
might be the best
if it sets the error state and not the predicate then set-error. it's set-error!
if it mutates too.
I used error state to hold the actual error and check with nil?
(or some?
) if there is an error condition.
In my case, the boolean makes sense. It's a very simple toggle for catching when an image fails to load.
you don’t want to show the reason
Nope. It's an external vendor who may have an image and if they don't they 404. There's nothing to fix.
But there might be a 500?
If external vendor 500s, I'm still not going to show an error. This image goes directly to their service.
I see.
In my case, the boolean makes sense. It's a very simple toggle for catching when an image fails to load.