Software Engineer
GitHub/Twitter: ejbyne
this.setState({ localState: 😍 })
Using local component state is fine. As a developer, it is your job to determine what kinds of state make up your application, and where each piece of state should live. Find a balance that works for you, and go with it.
Use React for ephemeral state that doesn't matter to the app globally and doesn't mutate in complex ways. For example, a toggle in some UI element, a form input state. Use Redux for state that matters globally or is mutated in complex ways. For example, cached users, or a post draft.
Sometimes you'll want to move from Redux state to React state (when storing something in Redux gets awkward) or the other way around (when more components need to have access to some state that used to be local).
The rule of thumb is: do whatever is less awkward.
Backend
Async action creator
UI Form
Post request
Error
Action creator
Error
Submit callback
Reducer
Error action
Store
Updated state (with error)
Selector
Parsed error
Raw error
e.g. /api/reviews?validate=true
2 options:
Software Engineer