1

An application I'm currently working on in our front end we currently use React, Redux and some singleton services (wrappers around some 3rd party libraries). We started discussing a new feature which we need to develop which involves non-changing data (as far as we can see) as it is set when the app is initialised, validated and available to the react application before our React.dom call. It is also used by some singleton services, such as a HTTP interceptor, that start in our root components constructor.

We then started discussing how we should store and use the data within our application.

We are split between storing this data using:

  1. Redux (as per app design); or
  2. a singleton service

Redux is amazing at re-rendering a component when values change and allowing intermediate states when a value is changing (I.e. a user logging in) while allowing access to that data with some additional boilerplate code. However this use case doesn't need this reloading mechanic so it seems a little overbaked whereas a singleton service seems like we don't need those benefits.

Both solutions technically work and will get the job done but what tool should we have used for that situation?

Also, if Redux is the correct one, should you ever create singleton services in React?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.