ReactJS difference between stateful and stateless
Yes, that is sort of the difference. Except with the stateful component you can also change the state, using this.setState for example: var React = require(‘react’); var Header = React.createClass({ getInitialState: function() { return { imageSource: “mypicture.png” }; }, changeImage: function() { this.setState({imageSource: “differentpicture.png”}); }, render: function() { return( <img src={this.state.imageSource} onClick={this.changeImage.bind(this)} /> ); } … Read more