This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-13
Channels
- # announcements (12)
- # babashka (88)
- # beginners (60)
- # biff (10)
- # calva (56)
- # clerk (9)
- # clj-kondo (5)
- # clojure (70)
- # clojure-austin (3)
- # clojure-conj (2)
- # clojure-dev (69)
- # clojure-europe (53)
- # clojure-nl (1)
- # clojure-norway (28)
- # clojure-uk (1)
- # clojurescript (27)
- # copenhagen-clojurians (3)
- # cursive (10)
- # datascript (1)
- # datomic (10)
- # fulcro (3)
- # funcool (1)
- # garden (7)
- # helix (5)
- # holy-lambda (5)
- # hyperfiddle (39)
- # introduce-yourself (6)
- # jobs-discuss (15)
- # lsp (3)
- # malli (5)
- # membrane (19)
- # missionary (1)
- # nrepl (6)
- # off-topic (44)
- # pathom (17)
- # pomegranate (3)
- # react (7)
- # releases (1)
- # shadow-cljs (39)
- # tools-deps (16)
- # xtdb (28)
I don’t use Helix, but logout-user
will compile to an ordinary JavaScript function. Secondly, your TopBar
component uses #(api/logout-user)
, which is shorthand for (fn [] (api/logout-user))
. This means you attempting to use React Hooks within a nested function. That’s likely why you’re getting the error.
My best guess to fix your issue is to change your :on-change
value to simply api/logout-user
Indeed, it's React that won't allow me to call the useNavigation
inside any function other than a component definition, so I need to call the hook on the TopBar and pass the return along I guess
thanks for the help!
to be clear: you can call hooks inside of a nested function. these are typically called "Custom hooks", example:
(defn use-counter
[init]
(hooks/use-state init))
(defnc my-component
[]
(let [[counter set-counter] (use-counter)]
,,,))