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 go back and forth between preferring set-error or set-error?
I usually end up refactoring it anyway to a use-reducer anyway once it gets more complex so I don’t really sweat it
error? is a function and set-error? sets the error? predicate?
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.
I trie to stay away from using booleans as much as possible 😛
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.