This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-05
Channels
- # announcements (14)
- # babashka (51)
- # beginners (154)
- # calva (24)
- # cider (4)
- # clj-kondo (24)
- # cljfx (11)
- # cljs-dev (3)
- # clojure (259)
- # clojure-europe (14)
- # clojure-nl (2)
- # clojure-seattle (8)
- # clojure-spec (6)
- # clojure-taiwan (1)
- # clojure-uk (52)
- # clojurescript (123)
- # conjure (43)
- # core-async (15)
- # datomic (14)
- # events (1)
- # fulcro (90)
- # helix (7)
- # jobs (6)
- # meander (10)
- # nrepl (1)
- # off-topic (13)
- # pathom (1)
- # portal (8)
- # re-frame (7)
- # reveal (11)
- # shadow-cljs (99)
- # spacemacs (11)
- # testing (11)
- # vim (63)
Hi there, I am working on a frontend application which involves Helix and I needed help it has this in the ns
[helix.hooks :as hooks]
(let [ [show-items] (hooks/use-state false)])
I have a navbar which has button, on click it suppose to invert this show-items. if show-item is false, :onclick it will be true;
{:onclick #(not show-items)}
it gives me an error saying that Uncaught Type-error show_item
. call is not a function.
My goal is to when I click on the button it changes that state and shows of all the items.show-items
is not a function but the state. I think you want
(let [[visible set-visible] (hooks/use-state false)])
And then:
{:onclick #(set-visible not)}
To toggle it I think🙌 3
Right. corrected. See https://github.com/lilactown/helix/blob/master/docs/hooks.md#maintaining-state and https://reactjs.org/docs/hooks-state.html for more examples.