This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-30
Channels
- # announcements (2)
- # bangalore-clj (6)
- # beginners (33)
- # cider (4)
- # clojure (9)
- # clojure-brasil (2)
- # clojure-spec (6)
- # clojurescript (36)
- # cursive (13)
- # datomic (3)
- # emacs (1)
- # fulcro (6)
- # graalvm (2)
- # interop (4)
- # luminus (1)
- # midje (1)
- # pathom (1)
- # random (1)
- # reagent (4)
- # shadow-cljs (11)
- # tools-deps (42)
- # xtdb (10)
@ballpark here’s a simple example how to integrate react-select
with reagent https://gist.github.com/pesterhazy/4a4198a9cc040bf6fe13a476f25bac2c
👍 8
What works best for you depends pretty much on your use-case(s). What features you need and how much compatibility across different platforms and devices you need.
For very simple use-cases I’d probably just use HTML5 datalist
(defonce app-state (atom {:text "Hello world!"}))
(defn autocomplete [{:keys [items on-change]}]
[:<>
[:input {:type "text" :list "id-123" :on-change on-change}]
[:datalist {:id "id-123"}
(for [item items]
[:option {:key item :value item}])]])
(defn hello-world []
[:div
[:h1 (:text @app-state)]
[autocomplete
{:items ["cat" "dog" "sheep" "chicken" "whale"]
:on-change #(swap! app-state assoc :selected-item (-> % .-target .-value))}]
[:h3 (str "Selected item: " (or (:selected-item @app-state) "-"))]])