What is the proper way to add console.log
and debugger
statements to my React.Components?
Just dropping them in produces Unexpected token
errors:
export class ManageCoursePage extends React.Component {
debugger;
constructor(props, context) {
super(props, context);
A little more helpful but still produces Unexpected 'debugger' statement
:
export class ManageCoursePage extends React.Component {
constructor(props, context) {
super(props, context);
debugger;
Or even browsers' console
errors out Uncaught SyntaxError: Unexpected token ;
:
class Woot {
debugger;
}
What exactly is going on here?
Move your debugger statement inside the constructor or a function and it'll work fine.