Closed icambron closed 2 years ago
@icambron You can pass arbitrary data with the meta
field:
export const search = keyword => ({
type: "SEARCH",
promise: makeSomeAPICall(keyword),
meta: {
keyword
}
});
You can then grab the action (containing the meta
data) as the second argument in your handler.
@iamchristopher I ended up doing just that after reading more code. It didn't strike me that that it was intended for that, though. Is it?
One problem I'm having is that I can't pass any extra context into the handlers because the rest of the action is stripped away. For example, let's say I have a search:
I'm putting
keyword
in the actual action because I want access to it at thestart
phase of my handler (e.g. to show some UI about it). But as far as I can tell, I don't have access to properties like that in my reducer, because pack isn't doing either of these: a) passing the original action's fields intodispatch
or b) passing the original action's fields into the event hooks.