Gabriel Trujillo C.
@TheDull
05-17-17
// Using React.createClass
var Counter = React.createClass({
getInitialState: function() {
return {counter: 0};
},
...
});
// Using ES6 classes
class Counter extends React.Component {
constructor(props) {
super(props);
this.state = {counter: 0};
}
...
}
The component state can be
changed calling:
this.setState(data, callback);
Whenever your object would be mutated, don’t do it. Instead, create a changed copy of it
It’s not all or nothing
Improve component performance
Data changes are more explicit
Certain features are easier
Needs dependencies
Less performant (small DS)
Demands team discipline
Simple and elegant concept
New things to learn:
Reducers
Immutables
Denormalization
Thunks & Sagas
Smart & Dumb components
No pedaling!
"Anything that can be derived from the application state, should be derived. Automatically."
// Can I haz some code, pwease?
Opinionated, transactional, MobX powered state container
Time traveling
Dedicado a Supernova
☁️🐱☁️