My code is very simple, I almost completely followed the react-bootstrap example here.
My code is as follows:
import {Component, PropTypes} from 'react';
var rbs = require('react-bootstrap'),
Panel = rbs.Panel;
export default class ResumeSection extends Component {< br /> constructor(...args) {
super(...args);
this.state = {
open: true
};
}
const title = (
Panel title
);
render() {
return (< br />
Body
);
}
}
An error occurred directly after the const, and just said SyntaxError: Unexpected Token
render() {
const title = (
Panel title
);
// ...
}
When I try to specify a constant, I receive an unexpected token error in React, and I can’t seem to figure out the reason.
My code Very simple, I almost completely followed the react-bootstrap example here.
My code is as follows:
import {Component, PropTypes} from'react' ;
var rbs = require('react-bootstrap'),
Panel = rbs.Panel;
export default class ResumeSection extends Component {
constructor(...args) {
super(...args);
this.state = {
open: true
};
}
const title = (
Panel title
);
render() {
return (
Body
);
}
}< /pre>An error occurred directly after const, and it just said SyntaxError: Unexpected Token
You cannot define one in the class body like that const; it should be moved to a method.
render() {
const title = (
Panel title< /h3>
);
// ...
}