The development team at my work use this pattern across our React apps. We also place all the action type variables in one file then import where needed. That way any developer looking at a project for the first time can see all API interactions in the app at a glance.
Hi Zhitomir,
Thanks for your valuable inputs.
Our team doesn't use this code directly. We have a lot of utility functions (inspired by redux-toolkit and redux-actions) which reduce this repetitive boilerplate code to zero. You can read the article published over here
Well, I have already used it in some of our projects, just shared my personal experience and this is one of the trends right now. I can verify that aforementioned pattern is easy to implement but of'course there are always alternatives. We try as much as possible to encapsulate each slice of the state in separate modul with all interfaces.
Hi Aileen,
Yes this is a very good approach. However, there is a lot of boilerplate code involved. I hope your team uses some libraries or utilities to avoid the boilerplate code. I have also published Part 2 of the article which shows a way to simplify the code a lot. You can read it here
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The development team at my work use this pattern across our React apps. We also place all the action type variables in one file then import where needed. That way any developer looking at a project for the first time can see all API interactions in the app at a glance.
Hi,
You can try to start implementing redux toolkit and redux thunk. It will simplify the aforementioned boiler plate code.
Hi Zhitomir,
Thanks for your valuable inputs.
Our team doesn't use this code directly. We have a lot of utility functions (inspired by redux-toolkit and redux-actions) which reduce this repetitive boilerplate code to zero. You can read the article published over here
Hi, thank you for your response.
Well, I have already used it in some of our projects, just shared my personal experience and this is one of the trends right now. I can verify that aforementioned pattern is easy to implement but of'course there are always alternatives. We try as much as possible to encapsulate each slice of the state in separate modul with all interfaces.
Hi Aileen,
Yes this is a very good approach. However, there is a lot of boilerplate code involved. I hope your team uses some libraries or utilities to avoid the boilerplate code. I have also published Part 2 of the article which shows a way to simplify the code a lot. You can read it here