1
I’m making a simple revenue registration app in React Turn on and I’m using Redux with Duck Pattern and reduxsauce, follow the code:
//DUCK DE RECEITA
import { createActions, createReducer } from 'reduxsauce';
//Criando actions types e creators
export const { Types, Creators } = createActions({
addReceita: ["receita"],
removeReceita: ["id"]
});
//criando Reducers Handlers
const INITIAL_STATE = [];
const add = (state = INITIAL_STATE, action) => [
...state,
{id: Math.random(), receita: action.receita}
];
const remove = (state = INITIAL_STATE, action) =>
state.filter(todo => todo.id != action.id);
//Crinado Reducer
export default createReducer(INITIAL_STATE, {
[Types.ADD_RECEITA]: add,
[Types.REMOVE_RECEITA]: remove
});
The problem is that for some reason the function createActions
of reduxsauce
is not creating the Creators
. Const Creators
is being returned as an empty object, but the const Types
is being returned correctly. And I haven’t found anything about this problem. Does anyone know what might be causing this?