Slide 27
Slide 27 text
Stateful Components
React makes use of stateful components.
Store your data as state and when the state
is updated the rendered markup will be re-
rendered depending on the change.
getInitialState() {
return {
users: {},
newUser: false,
user: {
name: this.props.player.name,
nickname: this.props.player.nickname,
points: this.props.player.points,
avatar: {
head: this.props.player.avatar.head,
body: this.props.player.avatar.body,
legs: this.props.player.avatar.legs,
}
},
}
},