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

Stateless vs Stateful

Stateless means there is no memory of the past. Every transaction is performed as if it were being done for the very first time. Stateful means that there is memory of the past. Previous transactions are remembered and may affect the current transaction. Stateless: // The state is derived by what is passed into the … Read more

techhipbettruvabetnorabahisbahis forumu