Fork me on GitHub

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: { ... }


Any ideas? Thanks!!


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 🙂


Isn’t a static method in JavaScript just smoke and mirrors?


(Honestly asking)


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?