We’ll dive into takeLatest, a saga helper that gives us the ability to control when our saga generator functions are called. We’ll then wire up takeLatest with our saga middleware and add it to the store.
Hi Tyler, I have a quick question - I think I've sufficiently confused myself - I see you call the event creator in App.js using props
, but from what I understand it is also an OK pattern in redux to do a direct import of the event creator like:
import { fetchStarWarsRequest } from '../actions';
and then switching the onClick
handler simply to:
<button onClick={fetchStarWarsRequest}>Load More</button>
However, modifying the code this way (I cloned this branch of the repo and modified it as a check), the sagas function will not fire! What additional code do I need to use action creators this way?
While this example passes props
only one level down, I don't always want to go through props to fire action creators (I'm incorporating sagas into a bigger app and need event creators a many different child layers, so the import
way is a bit easier for me - well, easier if I could figure out how to get it working!)
Any help, tips, or comments would be appreciated!