This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-25
Channels
- # admin-announcements (19)
- # alda (73)
- # announcements (1)
- # aws (16)
- # beginners (22)
- # boot (109)
- # cljs-dev (1)
- # clojure (79)
- # clojure-art (3)
- # clojure-czech (2)
- # clojure-russia (233)
- # clojure-sweden (2)
- # clojurescript (161)
- # clojurex (25)
- # core-async (2)
- # cursive (4)
- # datomic (11)
- # editors (17)
- # emacs (3)
- # funcool (4)
- # hoplon (72)
- # ldnclj (29)
- # off-topic (1)
- # om (9)
- # onyx (13)
- # reactive (10)
- # reagent (13)
- # yada (4)
Anyone managing focus in reagent with success? I.e. set the focus programmatically without the use of IDs
@lancefalcon: what's wrong with IDs ?
mccraigmccraig: makes my components non-reusable
@lancefalcon: when i need an id, i use a form-2 component, with (let [my-id (gensym "blahblah-")] ...) in the outer function
oh, gensym works at runtime as well?
that'll work, thanks a lot
gensym nice one thnx
@lancefalcon [:input {:autofocus true ...} ....]
will set focus the first time it renders
or is that auto-focus
?
something like that
Yeah, {:auto-focus true}
has been working fine for me.
@lancefalcon you can use dom-node instead of an id a lot of the time, and if you want it past the first render, you can use a lifecycle hook: https://github.com/tastejs/todomvc/blob/master/examples/reagent/src/cljs/todomvc/components/todo_edit.cljs