Open vendramini opened 5 years ago
I have the same issue, it works if I use the type key directly
const reducer = handleActions(
new Map([
[
INCREMENT,
(state, action) => ({
counter: state.counter + action.payload
})
],
However i would like to use the action itself as a key, like how i do with handleAction
I figured it out you can do
const reducer = handleActions(
new Map([
[
`${INCREMENT}`,
(state, action) => ({
counter: state.counter + action.payload
})
],
A simple example from docs:
Gives me an error:
I'm using
Next js
(react w/ server-side rendering), but I don't think it's related.Map
does exists on both client and server-side.I changed to
{type: function}
, but I would like to useMap
.Any ideas?
Thanks.