A new project is on the horizon, and the Product Owner has suggested using Redux for state management.
However, I am hesitant to embrace this suggestion as I fail to see the advantages compared to a model-based approach.
For instance, instead of utilizing plain objects in the store, reducers for computed properties, and actions for mutations, I prefer defining these functionalities directly within the models:
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)
...
}
}
Common arguments found in blog posts supporting Redux include:
- Redux shines in large applications/teams
- Centralizing all logic in one place facilitates better organization
Despite these claims, I personally find it more straightforward to structure code and navigate through my project with the outlined model-based system.
I've grown weary of clients who insist on adopting specific technology stacks, believing that flux/redux is the only "professional" path forward after reading about it. Convincing others that redux may not always be the optimal choice for projects in their early stages has proven challenging. Expressing concerns over its potential negative impact on development speed without substantial benefits at a smaller scale could mistakenly be perceived as laziness rather than pragmatic decision-making.