State Management
on Reactjs
Defining state
1
How it used to be
Angular, JQuery, or pure javascript
2
Javascript/JQuery
● DOM directly updated by the scripts
● Global variables and dom elements to maintain data and
state.
4
Angular
● Easier to get started
● Performance issues
● Two-way data bind - Changes in javascript updates the
view automatically
● Updates DOM directly
5
React
Virtual DOM, better state management and
funcional programming
6
Virtual DOM
● Compares virtual DOM and DOM before applying new
state
● Better performance
7
Local State
● Needs to be explicitly set (!= two way data bind)
● Every setState() triggers a rendering
● Container Components and Stateless components
8
Immutability
● Never mutate state and props
● Avoids side effects
9
Redux
10
11
Obrigado!
Alguma pergunta?

React State X angular