This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-24
Channels
- # announcements (11)
- # beginners (72)
- # calva (11)
- # cider (12)
- # clj-kondo (147)
- # clojure (6)
- # clojure-new-zealand (2)
- # clojuredesign-podcast (2)
- # clojurescript (36)
- # cursive (2)
- # datomic (5)
- # emacs (4)
- # fulcro (57)
- # graalvm (104)
- # graphql (2)
- # jobs (1)
- # joker (1)
- # kaocha (3)
- # malli (51)
- # off-topic (2)
- # portkey (1)
- # reagent (18)
- # shadow-cljs (26)
- # spacemacs (7)
- # tools-deps (5)
- # vim (4)
I'm looking at the create-class
docs here http://reagent-project.github.io/docs/master/reagent.core.html and it says that I can add :constructor
but when I do it - React shows an error create-react-class.inc.js:1170 Uncaught Invariant Violation: ReactClassInterface: You are attempting to define constructor on your component more than once. This conflict may be due to a mixin.
Well there you go. 🙂 According to git blame
, :constructor
has been there for only 3 months, and 0.8.1 is much older.
No problem. Oh, the documentation page itself says "Reagent 0.9.0-rc3". But I cannot find any way to switch it to a different version.
The same doc says `State can be initialized using constructor, which matches React.Component class, or using getInitialState which matches old React createClass function and is now implemented by Reagent for compatibility.`
That's why I was trying to change to :constructor
. The words "old" and "compatibility" triggered me 🙂
In fact, the official documentation still mentions it for the situations when you cannot use ES6 classes: https://reactjs.org/docs/react-without-es6.html#setting-the-initial-state
Thank you for pointing me at that doc. I've checked https://reactjs.org/docs/react-component.html and didn't find any mentions of getInitialState
Cljdoc has docs for 0.8.1: https://cljdoc.org/d/reagent/reagent/0.8.1/api/reagent.core
I've updated the readme to have separate links for 0.8 and 0.9 docs, there are several things in current docs that don't work with 0.8
As React docs say, using React without ES6 requires create-react-class
which 0.8 uses but 0.9 will instead create ES6 classes