I have a new project coming up and the PO suggested to use Redux for state management.
I would like to argue against it since I don't see the benefit compared to a model based approach.
I.e. instead of having plain objects in the store, reducers to get computed properties and actions to perform mutations I defined those on models themselves:
class User {
id = 'ec3d17a2-edee-48e6-b1cd-8f042a9e2a17'
firstname = 'Jon'
lastname = 'Doe'
get fullname() {
return this.firstname + ' ' + this.lastname
}
destroy() {
axios.delete('/users/'+this.id)
...
}
}
The arguments I read in most Blogposts are:
- Redux is great for large applications/teams
- It is easier to keep track of everything when all the logic is in one place
I think it is much easier to structure code and to find my way with above mentioned structure.
I am really fed up with clients that try to figure out a technology stack and think flux/redux is the only "professional" way after reading about it. I think it has become really hard to convince someone that redux is not necessarily the best choice for projects in their early stages. When I argue that it slows down development without creating much benefits at a small/medium scale I fear that it might get interpreted as laziness rather than ressourcefulness.