This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-23
Channels
- # announcements (6)
- # beginners (54)
- # calva (9)
- # cider (2)
- # clj-kondo (26)
- # cljsrn (2)
- # clojure (49)
- # clojure-brasil (1)
- # clojure-dev (3)
- # clojure-europe (11)
- # clojure-italy (28)
- # clojure-nl (5)
- # clojure-serbia (1)
- # clojure-spec (4)
- # clojure-uk (182)
- # clojuredesign-podcast (2)
- # clojurescript (59)
- # clojurex (9)
- # cursive (26)
- # data-science (11)
- # datomic (40)
- # duct (1)
- # emacs (3)
- # events (4)
- # figwheel-main (2)
- # fulcro (7)
- # instaparse (1)
- # kaocha (2)
- # leiningen (25)
- # off-topic (3)
- # re-frame (36)
- # reagent (15)
- # shadow-cljs (87)
- # spacemacs (12)
- # sql (20)
- # tools-deps (8)
- # vim (1)
- # yada (40)
Why we can't do this to update Component:
(def content (r/atom 0))
(js/setInterval (fn []
(swap! content inc)
(println @content)) 1000)
(defn home []
[:> rn/View {:style (styles :container)}
[:> rn/Text @content]])
If I try to define atom
in global, any update will invalid.do you mean to be updating this every second or just once?
I don't know what rnView
or rn/Text
are... what are those? is that react-native
?
@UJ9KCME4U t's a good solution. I also get it in reagent
docs, we can do as official suggestions to avoid some problems.
What's the meaning of But ... when the re-render occurs because an input ratom changed, Lifecycle functions are not run.
in https://github.com/reagent-project/reagent/blob/master/doc/WhenDoComponentsUpdate.md#lifecycle-functions
in React there are things called life-cycle methods (https://programmingwithmosh.com/javascript/react-lifecycle-methods/) Normally, life-cycle methods are called in a certain order
componentWillMount
, componentDidMount
,
shouldComponentUpdate
, componentWillUpdate
, renderComponent
, componentDidUpdate
,
componentWillUnmount
,
componentDidUnmount
that's the usual lifecycle
what he's saying is that if the props change, only renderComponent
will run and the rest of the lifecycle methods will be ignored
@U3BALC2HH Thanks for your answer, I will try it to test.
Anyone could provide me some insight on how to use js react components that uses the context API in reagent? I always get that this.context.localize
does not exists. For the record I am trying to adapt this example:
In clojurescript