This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-08
Channels
- # announcements (1)
- # babashka (18)
- # beginners (32)
- # calva (3)
- # chlorine-clover (4)
- # cider (14)
- # clj-commons (24)
- # clj-kondo (1)
- # clojure (34)
- # clojure-europe (4)
- # clojure-filipino (1)
- # clojure-uk (4)
- # clojuredesign-podcast (2)
- # clojurescript (6)
- # conjure (3)
- # core-async (2)
- # datahike (1)
- # datomic (3)
- # emacs (3)
- # esprit (20)
- # fulcro (4)
- # graalvm (11)
- # helix (13)
- # honeysql (4)
- # jobs (1)
- # lumo (1)
- # observability (4)
- # off-topic (11)
- # other-lisps (6)
- # pathom (6)
- # re-frame (13)
- # reagent (1)
- # reitit (1)
- # shadow-cljs (26)
- # web-security (2)
- # xtdb (10)
if you're using git deps, I believe the URLs to repos should still work but they should be updated soon
Hello, what am I doing wrong here? I'm trying to get an array of map in the response body and display them.
I can see the log of the response body, but not the console.log inside the for
(defnc list-view []
(let [[state set-state] (hooks/use-state '())]
(hooks/use-effect*
:once
(go (let [response (<! (http/get ""
{:with-credentials? false}))]
(println "RESPONSE BODY " (:body response))
(set-state (:body response)))))
($ :div "List of goals")
(for [goal state]
(do (js/console.log "goal for " goal)
($ :div (:title goal))))))
console log
RESPONSE BODY [{:description goal desc 1, :updated-at 2020-08-08T20:54:30Z, :installment-amount 1000, :target-date 2021-09-01T00:00:00Z, :title goal 1, :id 4fffed2e-9e7f-4b1a-a760-79b40a37cd27, :start-date 2020-08-01T00:00:00Z, :created-at 2020-08-08T20:54:30Z, :wallet-id 968d8164-b864-441f-804b-7ade37ce112f, :target-amount 13000} {:description goal desc 2, :updated-at 2020-08-08T20:54:30Z, :installment-amount 1000, :target-date 2021-09-01T00:00:00Z, :title goal 2, :id cdfc0783-899f-4ad0-aa64-e903702824cc, :start-date 2020-08-01T00:00:00Z, :created-at 2020-08-08T20:54:30Z, :wallet-id 968d8164-b864-441f-804b-7ade37ce112f, :target-amount 13000}]
console errors
Uncaught Error: [object Object] is not ISeqable
at Object.cljs$core$seq [as seq] (core.cljs:1251)
at Object.cljs$core$to_array [as to_array] (core.cljs:3662)
at Function.eval [as cljs$core$IFn$_invoke$arity$2] (hooks.cljc:173)
at limeray.web.route/list-view (route.cljs:94)
at renderWithHooks (react-dom.development.js:16261)
at beginWork$1 (react-dom.development.js:18795)
at HTMLUnknownElement.callCallback (react-dom.development.js:337)
at Object.invokeGuardedCallbackImpl (react-dom.development.js:386)
at invokeGuardedCallback (react-dom.development.js:441)
at beginWork$$1 (react-dom.development.js:25781)
The above error occurred in the <limeray.web.route/list-view> component:
in limeray.web.route/list-view (created by )
in div (created by )
in
Consider adding an error boundary to your tree to customize error handling behavior.
Visit to learn more about error boundaries.
console warning
error when calling lifecycle function limeray.web.core/after-load Error: [object Object] is not ISeqable
at Object.cljs$core$seq [as seq] (core.cljs:1251)
at Object.cljs$core$to_array [as to_array] (core.cljs:3662)
at Function.eval [as cljs$core$IFn$_invoke$arity$2] (hooks.cljc:173)
at limeray.web.route/list-view (route.cljs:94)
at renderWithHooks (react-dom.development.js:16261)
at beginWork$1 (react-dom.development.js:18795)
at HTMLUnknownElement.callCallback (react-dom.development.js:337)
at Object.invokeGuardedCallbackImpl (react-dom.development.js:386)
at invokeGuardedCallback (react-dom.development.js:441)
at beginWork$$1 (react-dom.development.js:25781)
hmm, well first thing I notice is you're use use-effect*
. I think you'll want to use use-effect
(no star)
use-effect*
should only be used for weird, advanced use-cases
you'll notice that the docstring for use-effect*
is different than use-effect
:
(defn use-effect*
"Like react/useEffect. See `use-effect` for details on what `f`'s return values. See namespace doc for `deps`.")
([f])
([f deps])
are the aritys.
the star version wants the arguments in the opposite order of the non-start onethe error you're seeing is because it's trying to treat the function as a JS array 😓
Oh ok, just curious, does the error below tells that error you mentioned?
at Object.cljs$core$seq [as seq] (core.cljs:1251)
at Object.cljs$core$to_array [as to_array] (core.cljs:3662)
at Function.eval [as cljs$core$IFn$_invoke$arity$2] (hooks.cljc:173)
at limeray.web.route/list-view (route.cljs:94)
it doesn't tell me immediately what the issue was. but the use of use-effect*
looked funny (as opposed to use-effect
), and when I read the source of use-effect*
it made sense