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

Syntax error: Unexpected token #75

Closed
bluengreen opened this issue Oct 7, 2016 · 3 comments
Closed

Syntax error: Unexpected token #75

bluengreen opened this issue Oct 7, 2016 · 3 comments
Assignees

Comments

@bluengreen
Copy link

Great work BTW. This actually has helped me learn tons about react. After spending weeks playing with other peoples boiler plates, this got me going where I could stay interested enough to learn more.

Firstly I was trying to get the theming working which sadly didn't do anything. I included the themes and pass into the Admin component but no joy.

I figured I'd go ahead and follow the custom layout docs. But then after copying the code for Notifications, Title, Menu, Layout I get this error:

Failed to compile.

Error in ./src/Notification.js
Syntax error: Unexpected token (23:28)

  21 |             message={this.props.message}
  22 |             autoHideDuration={4000}
> 23 |             onRequestClose={::this.handleRequestClose}
     |                             ^
  24 |             bodyStyle={style}
  25 |         />);
  26 |     }

 @ ./src/myLayout.js 32:20-45

Apologize in advance if its obvious but I am new to ES6. Not sure what :: is doing and its kinda impossible to google such a thing. Could anyone help point me in the right direction?

Thanks in advance.

@djhi
Copy link
Contributor

djhi commented Oct 9, 2016

You need to configure babel correctly for it to handle this syntax. It's a shortcut for this.handleRequestClose.bind(this)

@bluengreen
Copy link
Author

Thanks for the insight. I installed like the docs as suggested - using create-react-app. What is the correct way to configure babel? Doesn't create-react-app configure babel when creating a new app? Also, could this be the reason why theming isn't working correctly?

Thanks again.

@djhi
Copy link
Contributor

djhi commented Oct 10, 2016

Can you share your webpack configuration in a code pen along with the App component showing how you specify the theme ?

fzaninotto added a commit that referenced this issue Oct 10, 2016
@fzaninotto fzaninotto self-assigned this Oct 10, 2016
@djhi djhi closed this as completed in #78 Oct 10, 2016
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

3 participants