This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-11
Channels
- # adventofcode (108)
- # announcements (4)
- # aws (11)
- # babashka (39)
- # beginners (199)
- # calva (12)
- # clj-kondo (17)
- # cljs-dev (1)
- # clojure (115)
- # clojure-dev (9)
- # clojure-europe (98)
- # clojure-italy (17)
- # clojure-nl (4)
- # clojure-norway (3)
- # clojure-seattle (7)
- # clojure-sweden (6)
- # clojure-switzerland (5)
- # clojure-uk (15)
- # clojurescript (41)
- # code-reviews (36)
- # conjure (7)
- # datomic (1)
- # emacs (1)
- # events (1)
- # fulcro (26)
- # graalvm (2)
- # helix (35)
- # jackdaw (2)
- # jobs (9)
- # jobs-discuss (5)
- # lambdaisland (2)
- # meander (24)
- # off-topic (80)
- # pathom (22)
- # pedestal (1)
- # portal (20)
- # re-frame (3)
- # releases (1)
- # reveal (13)
- # rewrite-clj (1)
- # shadow-cljs (8)
- # specter (5)
- # sql (4)
Hi Everyone, I am a JavaScript dev (new to clojure), I am working with yarn package react-google-recaptcha. I am currently facing an issue to get back a token after verifying the recaptcha. If I do it in Javascript the onChange(value) function returns the token
function onChange(value) {
console.log("Captcha value:", value);
}
ReactDOM.render(
<ReCAPTCHA
sitekey="Your client site key"
onChange={onChange}
/>,
document.body
);
But I try this in ClojureScript and I am getting nothing in the console
(defn onChange [value]
(println value)
)
($ ReCAPTCHA
{ :sitekey "Your client site key"
:onChange #(onChange) })
(note $ is helix lib)
it tell me that wrong number of args (0) passed to onChange
Can someone please tell where am I wrong?onChange
expects an argument .`onChange={onChange}` means call the function onChange with the event. #(onchange)
means is a shorthand for (fn [event] (onchange))
where you are not sending the event through. just do :onChange onChange
which is exactly what the js version is doing
that's what #(onchange)
expands to in essence. and its calling a 1 arity function with no args. which is what your error is
@singhamritpal49 also i think this is just a clojurescript question and so belongs in #clojurescript in the future