Stateful vs stateless component code example
Example: how to write statefull class in react
import React, {Component} from 'react'
class Pigeons extends Component {
constructor() {
super()
this.state = {
pigeons: []
}
}
render() {
return (
<div>
<p>Look at all the pigeons spotted today!</p>
<ul>
{this.state.pigeons.map(pigeonURL => {
return <li><img src={pigeonURL} /></li>
})}
</ul>
</div>
)
}
}