This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-21
Channels
- # adventofcode (24)
- # announcements (1)
- # beginners (122)
- # braveandtrue (9)
- # calva (45)
- # cider (24)
- # cljdoc (8)
- # cljs-dev (23)
- # clojure (112)
- # clojure-europe (2)
- # clojure-india (2)
- # clojure-italy (36)
- # clojure-nl (3)
- # clojure-spec (32)
- # clojure-uk (35)
- # clojurescript (52)
- # core-typed (12)
- # cursive (4)
- # datomic (61)
- # emacs (4)
- # figwheel-main (2)
- # fulcro (14)
- # hoplon (5)
- # hyperfiddle (1)
- # jobs-discuss (6)
- # kaocha (5)
- # leiningen (2)
- # nrepl (15)
- # off-topic (62)
- # re-frame (26)
- # reagent (39)
- # ring (3)
- # shadow-cljs (56)
- # spacemacs (8)
- # specter (5)
- # tools-deps (1)
- # yada (2)
Hi , how to access form field value in a :on-click
function
Any jquery wrappers to use to access by selectors?
@manas.marthi you probably don’t want to use jquery or selectors
if it’s the value of the field that is clicked, you can access it in the callback you give to the :on-click
function
(defn handle-click [event]
(println (.. event -target -value)))
[:input {:on-click handle-click}]
hi, i’m trying ot follow the react tic tac toe tutorial and port to reagent
does reagent have an equivalent of this.props.onClick()
all the examples i’ve found are on dom elements but not react components
it looks like i might have to pass a function in as a paramter
for it to invoke
like people used to do in angular 1
your reagent component (a function) can take in any kind of data and use it, e.g. a function
that got me into all sorts of messes in angular 1
thats why the angular output parameters arrived, the reverse the dependency
i think in react you dont pass functions through exactly, but invoke them indirectly
e.g. you’d render your Square
component like so:
<Square onClick={function () { alert("clicked!") }} />
i found some guy who has done the same thing as me online
and that’s how he’s done it 🙂
thanks
it’s pretty mad, you can define a component as a variable in a let block!
Hi, I want to trigger validation fn on click of submit and go through individual fields and validate them and display errors along with style changes like turning border color to red
Is there any API for this routine task?
I've used https://github.com/reagent-project/reagent-forms before
@manas.marthi the first step is keeping your state inside of an atom
then, when the user clicks submit, it you can run your logic to validate the data contained in the atom