This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-05
Channels
- # announcements (1)
- # beginners (72)
- # boot (4)
- # calva (35)
- # cider (8)
- # clara (13)
- # cljdoc (31)
- # cljs-dev (34)
- # clojure (64)
- # clojure-europe (1)
- # clojure-finland (3)
- # clojure-italy (23)
- # clojure-losangeles (3)
- # clojure-nl (35)
- # clojure-uk (19)
- # clojurescript (26)
- # cursive (19)
- # datomic (12)
- # duct (5)
- # editors (7)
- # emacs (25)
- # fulcro (40)
- # funcool (5)
- # jobs (2)
- # leiningen (3)
- # luminus (2)
- # lumo (3)
- # off-topic (19)
- # pathom (3)
- # planck (2)
- # reagent (6)
- # remote-jobs (4)
- # rum (1)
- # shadow-cljs (23)
- # spacemacs (6)
- # tools-deps (12)
Hi! I’m trying to create a React component that has a static function. Being new to clojurescript and reagent, I haven’t got a clue how to accomplish this. What I’m looking for is the equivalent of this JavaScript code:
class StyledScreen extends Component {
static options(passProps) {
return {
topBar: { ... }
}
}
...
}
Ok solved for now, turns out in my case the method doesn’t actually have to be static, even though the docs of the component says so. I’m still interested in the answer though for academic reasons 🙂
Kind of I guess. There is this ‘prototype’ thing. I’m not sure how this works actually. But suppose you define an ES6 class and pass it around to a library, and then the library instantiates it (once or more). In that case you would need to have the static function there if you want it to end up in the instance, right?