Closed robinweser closed 6 years ago
Instead of exposing setState freely, we could even restrict effects more to just calling actions. Could be great in terms of testing and separation:
const model = [] const actions = { addUser: (state, user) => [ ...state, user ] } const effects = { postUser: (actions, user) => fetch("api.com/users", { method: 'POST', body: JSON.stringify(user) }).then(res => res.json()).then(actions.addUser) }
Instead of exposing setState freely, we could even restrict effects more to just calling actions. Could be great in terms of testing and separation: