This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next 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:46] sausage |
||
---|---|---|---|
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. | ||
Line 468: | Line 473: | ||
There has been no need to implement any local state in any of the components. All have been driven by the useSelector hook back from the main application state. | There has been no need to implement any local state in any of the components. All have been driven by the useSelector hook back from the main application state. | ||
+ | |||
+ | Finally a big thanks to my friends Andrew and Adam for reviewing the content of this article for me. | ||
===== References and further reading ===== | ===== References and further reading ===== |