Explain Difference: Stateful vs Stateless 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>
)
}
}