Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example in readme not working. #20

Open
eborst opened this issue May 5, 2017 · 1 comment
Open

example in readme not working. #20

eborst opened this issue May 5, 2017 · 1 comment

Comments

@eborst
Copy link

eborst commented May 5, 2017

Example in the readme gives compile error.

Error in ./src/App.js Syntax error: C:/data/projects/test-admin/src/App.js: 'this' is not allowed before super() 10 | class App extends Component {
11 | constructor() {

12 | this.state = {
| ^
13 | widgets: {
14 | WordCounter: {
15 | type: CounterWidget, @ ./src/index.js 13:11-27

@Raathigesh
Copy link
Owner

Raathigesh commented Jul 22, 2017

class App extends Component {
  constructor() {
    super(); // this is missing in the docs
    this.state = {      
      widgets: {
        WordCounter: {
          type: CounterWidget,
          title: 'Counter widget',
        }
      },
      layout: {
        rows: [{
          columns: [{
            className: 'col-md-12',
            widgets: [{key: 'WordCounter'}],
          }],
        }],
      }
    };
  }

  render() {
    return <Dashboard  widgets={this.state.widgets} layout={this.state.layout}  />
  }
}

Could you please try adding super() call. I'll update the docs.

Also have a look at the starter kit example here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants