On 22 Apr 2018, at 03:55, Chen Bing <eda...@gmail.com> wrote:

> https://reagent-project.github.io/
> Example "BMI calculator",
>     Slider  initialized with assoc atom(bmi-data),it's a copy of 
> atom(bmi-data)
>           ,why atom (bmi-data) change will repaint Slider?

The component being rendered is bmi-component. The component calls calc-bmi, 
which dereferences mmi-data: @bmi-data is a deref. bmi-data is a reagent atom 
and reagent atoms are set up so that components referring to the atom re-render 
when the atom changes, as noted earlier on the page you linked to:

> The easiest way to manage state in Reagent is to use Reagent’s own version of 
> atom. It works exactly like the one in clojure.core, except that it keeps 
> track of every time it is deref’ed. Any component that uses an atom is 
> automagically re-rendered when its value changes.


Alan

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to