Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Andrew Gursky12,576 Points
I'm confused by some of the syntax changes that were made when modularizing, specifically in Scoreboard.js
After modularizing the app, the key value properties of the scoreboard component were changed to just regular declarations of variables and functions. So in this methodology the scoreboard component is no longer an object? like onScoreChange went from being onScoreChange: to onScoreChange = (index, delta) =>.
I understand ES6. But does it always have to be like this when modularizing? Can you keep it as an object if export is called separately at the bottom?
Michael Chi8,330 Points
You don't have to. For example you don't have to use :
export default class Scoreboard extends Component
You can use the
It's just that the class syntax may look better visibility, and it works. However, I think
React.createClass is deprecated in newer versions of React, so the class syntax is a better option.