Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ns react-select.core
- (:require [re-frame.core :as re-frame]
- [reagent.core :as r]
- [cljsjs.react-select]))
- (def payment-modes ["Amex" "Visa" "Cash" "Paypal"])
- (def payment-options
- (mapv zipmap (repeat [:label :value]) (mapv vector payment-modes (range 10))))
- (def selected-values (r/atom nil))
- (defn react-select
- [placeholder options val]
- [:> js/Select
- {:isMulti true
- :options options
- :placeholder placeholder
- :value @val
- :on-change #(reset! val (js->clj % :keywordize-keys true))}])
- (defn component []
- [react-select "Payment mode" payment-options selected-values])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement