Set data:
export const setIngredients = (ingredients) => {return { type: actionTypes.SET_INGREDIENTS,ingredients : ingredients}}
Get data:
export const initIngredients = () => {return dispatch => {axios.get('....').then(response => {dispatch(setIngredients(response.data));}).catch( error => {dispatch(fetchIngredientsFailed())})} }
Error:
Objects are not valid as a React child (found: object with keys {objectId, name, createdAt, updatedAt, value}). If you meant to render a collection of children, use an array instead.
return dispatch => {
axios.get('......').then(response => {dispatch(setIngredients(response.data)
);}).catch( error => {dispatch(fetchIngredientsFailed())}