1

I'm new to React and Redux and have come to a problem I think might take me down a dark road.

My application state object thus far has purely contained properties that are specific to the application state.

But now I have a problem to solve where I need to render a specific component based on the result of an api call.

So here I need to record state, that only the UI is concerned with.

I have it working by adding a UI object to my state object, and have created a UI reducer and UI actions.

When the api call returns its response, the ui object in my state is updated.

I then use that state as a condition on whether to render the component in question.

I'm uneasy adding ui specific state to redux store.

Is this a bad move?

nbkhope
  • 7,360
  • 4
  • 40
  • 58
Derek
  • 8,300
  • 12
  • 56
  • 88
  • 4
    If you show some code, it would be easier to understand what you are trying to achieve. – Hosar Mar 31 '17 at 15:28
  • 1
    It's not a bad move. Your store should contain all the application state, including the UI. It is up to you to design the store accordingly. – Diogo Sgrillo Mar 31 '17 at 17:03
  • Similar Question: https://stackoverflow.com/questions/48925561/how-to-handle-ui-state-in-redux-react-redux-ui – David Lin Mar 09 '18 at 00:10

0 Answers0