difference between stateful and stateless in reactjs code example
Example: stateful component vs stateless component
class Parent extends Component {
constructor() {
super()
this.state = {
books: [],
favoriteAuthors: []
}
}
render() {
return (
<div>
<Books books={this.state.books} />
<FavoriteAuthors favoriteAuthors={this.state.favoriteAuthors} />
</div>
)
}
}