Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

AllenLiberty/Weather-Redux

Repository files navigation

Weather-Redux

I use redux architecture in this demo

Advantage:

  1. The dataflow is unidirectional that means your data gets processed in one-direction. The idea behind it is that your subscribers (e. g. ViewController) only listens for updates and doesn’t manipulate the data it receives.
  2. You can find the real state of your app and model action. It make everything easy to understand
  3. Maximises separation of concerns. Every component does only one job.
  4. Improves testability. Reducers has pure functions that are really easy to test.

we can find the Action/Thunk/Store/State in this demo

  1. WeatherStore: receives actions uses the Reducer to replace the state, and fires off the new state to subscribed views
  2. WeatherState: a constant struct that defines and contains the state in memory. if In large app we can made up of sub-state
  3. WeatherReducer: a pure function that is given old state and an action, and it returns a new state struct that’ll replace the old one in the store.
  4. WeatherAction: simple structs that the Reducer uses to update state.
  5. WeatherThunk: implementation of the unidirectional data flow architecture in this case I do the netwok and requset location

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /