Skip to content

Instantly share code, notes, and snippets.

@Sstobo
Created January 17, 2018 19:54
Show Gist options
  • Save Sstobo/60dbc56ae55a0775feb2a5ba185dc3f0 to your computer and use it in GitHub Desktop.
Save Sstobo/60dbc56ae55a0775feb2a5ba185dc3f0 to your computer and use it in GitHub Desktop.
[React Redux vocabulary] #
REDUX GIVES YOU THE STORE, DISPATCH AND REDUCERS
###
store holds state
state is 0
click the +1 button
'dispatches an action (which is action and state) to reducer
switch in reducer = if ActionType = type(increment) and payload (1), use the increment switch in the reducer to add 1 to state
state gets send back to store
###
Currying = calling a function with fewer arguments than it expects
Use redux if:
Its gonna be a big project
If its shared
If its persisted
Reducer - how does action change state . SHOULD BE CALLED UPDATER
Action - sent off (dispatched) contain data (payloads)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment