flipper-plugin-redux-debugger
flipper-plugin-redux-debugger copied to clipboard
How do you pass a Payload when you dispatch an action?
From the code side I dispatch my action like this
dispatch({
type: DO_SOMETHING,
payload: {
foo: 'cat',
bar: 'dog'
}
});
When I try to dispatch this action with a payload from the flipper plug in
{
'foo': 'cat',
'bar': 'dog'
}
It tells me undefined is not an object and pin points me to action.payload.foo. So I assume the payload is not passed from the plug in. How do I give it a payload?
You need to pass the object you would dispatch in your code to the plugin.
E.g.
{ type: DO_SOMETHING, payload: { foo: 'cat', bar: 'dog' } }
In redux, even though payload is a standard but it is not a default field. The flexibility trade off requires user to supply the field name.
If you have a payload which is not an object just pass {"payload": xxx}