Weitere ähnliche Inhalte
Ähnlich wie The Redux State of the Art - Shem Magnezi+Limor Mekaiten, WeWork (20)
Mehr von DroidConTLV (20)
Kürzlich hochgeladen (20)
The Redux State of the Art - Shem Magnezi+Limor Mekaiten, WeWork
- 18. fun reduce(oldState: AppState, action: Action) : AppState {
return when (action) {
is MarkAllAsRead -> {
return oldState.copy(unreadConut = 0)
}
else -> oldState
}
}
Reducers
- 20. fun reduce(oldState: AppState, action: Action) : AppState {
return when (action) {
is AddNotificationAction -> {
return oldState.copy(
unreadConut = oldState.unreadConut + 1,
notifications = action.notification +
oldState.notifications)
}
...
else -> oldState
}
}
Reducers
- 23. Logic is made easy
● Implicit data flow of your app becomes explicit
● Easy to spot edge cases - you get to see the missing
cases now
- 24. Debugging is made easy
● Single source of truth
● Testing made easy -
issue the action, see
how your state changes
● Time travel
- 27. Redux can help you manage the app’s
state (and save you a lot of headaches)
- 29. More resources
Slides: http://shem8.github.io/talks/
Redux Docs: https://redux.js.org/
Dan Abramov’s talk: https://youtu.be/xsSnOQynTHs
Reductor: Redux implementation in Java: https://github.com/Yarikx/reductor
Bansa: Redux implementation in Kotlin: https://github.com/brianegan/bansa
Dan Abramov’s Redux tutorial:
https://egghead.io/courses/getting-started-with-redux