Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. (ns react-select.core
  2. (:require [re-frame.core :as re-frame]
  3. [reagent.core :as r]
  4. [cljsjs.react-select]))
  5.  
  6. (def payment-modes ["Amex" "Visa" "Cash" "Paypal"])
  7.  
  8. (def payment-options
  9. (mapv zipmap (repeat [:label :value]) (mapv vector payment-modes (range 10))))
  10.  
  11. (def selected-values (r/atom nil))
  12.  
  13. (defn react-select
  14. [placeholder options val]
  15. [:> js/Select
  16. {:isMulti true
  17. :options options
  18. :placeholder placeholder
  19. :value @val
  20. :on-change #(reset! val (js->clj % :keywordize-keys true))}])
  21.  
  22. (defn component []
  23. [react-select "Payment mode" payment-options selected-values])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement