score:0

Accepted answer

if you very want to put react class as value into object (without intermediate variable) you can use non es6 syntax instead. the example:

var createreactclass = require('create-react-class');

const myreactclasses = {
  firstclass : createreactclass({
    render: function() {
      return <h1>hello, {this.props.name}</h1>;
    },
  }
}

the es6 syntax does not return value but create a variable so you need write like this:

class firstclass extends react.component {
   myfunction() {
     render: function() {
       return <h1>hello, {this.props.name}</h1>;
     },
   },
}

const myreactclasses = {
  firstclass : firstclass,
}

# or more simple 

const myreactclasses = {
  firstclass,
}

score:1

define the class outside of the myreactclasses constant.

js syntax doesn't allow what you're trying to do. with either method the components should be defined in a file external to the object containing them if for no other reason than readability.


Related Query

More Query from same tag