Fork me on GitHub
#reagent
<
2022-05-18
>
Clément Ronzon16:05:56

Hi there, I am trying to use the rc-year-calendar react component (https://github.com/year-calendar/rc-year-calendar) in my re-frame application using Reagent. This is how I adapted it:

(ns my.ns (:require ["rc-year-calendar" :as calendar]))
(defn full-year-calendar
  []
  (let [state (reagent/atom [])]
    (fn []
      [:> calendar {:dataSource @state
                    :onDayClick #(swap! state conj {:startDate (.-date %) :endDate (.-date %)})}])))
I call it in one of the views using [my.ns/full-year-calendar]. I am facing an issue where each time the user clicks (and triggers onDayClick) the calendar component blinks, it’s like if it would completely be re-built each time. Please did anyone faced this kind of weirdness when integrating a react component?

p-himik16:05:42

That's exactly how it works in vanilla React. So my guess is that the component itself isn't that great.

Clément Ronzon16:05:53

Ok, TY for raising that up @U2FRKM4TW! 🙂

👍 1