Created
October 19, 2018 22:11
-
-
Save yogthos/9a306dc9d3f8e51a0bcbda55fce99d43 to your computer and use it in GitHub Desktop.
example of adapting Reagent atom based API to re-frame
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns re-frame.datepicker | |
(:require [cljs-pikaday.reagent :as pikaday])) | |
(defn datepicker [k] | |
(r/with-let [date (r/atom @(rf/subscribe [:schedule/event-modal-details-value k])) | |
date-tracker (r/track! #(rf/dispatch [:schedule/update-event-modal-details k @date]))] | |
[pikaday/date-selector | |
{:date-atom date | |
:pikaday-attrs {:format "YYYY-MM-DD"} | |
:input-attrs {:read-only true :class "form-control"}}] | |
(finally (r/dispose! date-tracker)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment