This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-21
Channels
- # babashka (11)
- # beginners (15)
- # cider (2)
- # cljdoc (36)
- # cljsrn (3)
- # clojure (6)
- # clojure-europe (9)
- # clojurescript (17)
- # conjure (3)
- # deps-new (6)
- # development-containers (1)
- # emacs (3)
- # fulcro (4)
- # gratitude (14)
- # introduce-yourself (2)
- # joker (14)
- # lsp (1)
- # luminus (7)
- # malli (6)
- # polylith (7)
- # releases (1)
- # reveal (3)
- # sql (4)
- # vim (18)
So, thanks to #helix and #clojurescript, MatrixRN is coming along OK. Only "OK" because FB engineers just seem to make things up as they go and I am starting to think I will have to handle every built-in component differently. Whining aside, my next milestone is async HTTP.
Is https://github.com/r0man/cljs-http the way to go? Not seeing anything else other than interop with fetch
. Thx! 🙏
Got a dummy interop Q here: what on Earth is #object[String]
?
Using the cljs-http example:
(http/get "https://api.github.com/users"
{:with-credentials? false
:query-params {"since" 135}})
I pull the users as suggested with: (map :login (:body response))
Looks great, except when I offer the first as the title of a Button (have not figured out Text yet, of all things), ReactNative complains: "Invariant Violation: The title prop of a Button must be a string"
So I print out the type and sure enough it is #object[String]. js->clj does not help. str
works, but I do not get why: (type (str etc)) also returns #object[String]!
Weirdly, if I (map str (map :login etc)) as soon as I get the response, I still have to call str
when passing the first username as the title!
So...what on Earth is #object[String]
?! The Google is silent, tho with tons of hits on translating key-value kinda objects.
btw, I can use goog.object to get all the keys: length, 1,2,3... 🙂
object[String] aside, I am exploring having cljs-http convert the response (if I can figure out that incantation). But that would be an ugly way out.
So the response body values are all ValSeq's, and the right way to convert to a string RN will like is --wait for it -- str
!