I'm using meteor with react.
In a component's class, I have the following:
const Media = (props) => {
...
}
But this is not working and I don't see why. I have a build error at the first line:
Unexpected token, expected (
It seems I cannot use "const" in my class. I cannot define stateless components.. Thanks for your help!
A small additional finding:
If I'm defining a component as follows:
import React from 'react';
const Test = () => {
return (<img src=".." />);
}
export default Test;
Then I can import the component and everything works fine.
Now, if I have a nested 'component' as follows: import React from 'react';
class Test extends React.Component {
const Test = () => {
return (<img src=".." />);
}
render(){
return(<img src=".." />)
}
}
export default Test;
Then I got the error on the "const" line. Is this something that cannot be done? I have seen different code examples using such structures.