This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
reactjs_and_friends [2021/10/20 04:41] sausage Thunk added to make explicit |
reactjs_and_friends [2021/11/03 10:43] sausage [actions.js] |
||
---|---|---|---|
Line 192: | Line 192: | ||
- fetchRemoteDataThunk: load the planet data remotely from https://waynejohnson.net/planets in a cors friendly way. | - fetchRemoteDataThunk: load the planet data remotely from https://waynejohnson.net/planets in a cors friendly way. | ||
- fetchLocalPlanetDataThunk: load it from a local copy, and add in an artificial delay. | - fetchLocalPlanetDataThunk: load it from a local copy, and add in an artificial delay. | ||
+ | |||
+ | <WRAP center round tip 90%> | ||
+ | For sake of ease I've thrown the thunks into the actions file, but ideally these would imported from their own file. | ||
+ | </WRAP> | ||
+ | |||
The Action Creators are written as simple functions that can pass in data. This makes it easy for a component to import an action which can be dispatched and data passed along too. | The Action Creators are written as simple functions that can pass in data. This makes it easy for a component to import an action which can be dispatched and data passed along too. |