React With ES6 not working while creating atmosphere packages

457 views Asked by At

When i create component in react without using es6 in atmosphere package like below:-

var createReactClass = require('create-react-class');
AddTag = createReactClass({
   render:function(){
      return(
        <div>Hello</div>
      )
   }
});
export default AddTag;

and in package.js

api.addFiles('components/tags/addTag.jsx',['client'])
api.export(["AddTag"]);

this code working fine.

but when i use react with es6 like below:-

import React, { Component } from 'react';
class AddTag extends React.Component{
    render{
       return(
           <div>Hello</div>
       )
    }
}
export default AddTag;

and package.js is same as above.

but i am getting below error with es6:-

Invariant Violation: Minified React error #130; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

Please advice what i do to resolve this error.

Thanks, Regards, Saransh

1

There are 1 answers

1
Paul McBride On

It looks like you have a syntax error. Change the render method to this...

render() {
   return(
       <div>Hello</div>
   )
}

Notice the parentheses on the render method definition.