User1034446946 posted
Hi
I have my state in redux, and i have a recuring function that at the start of every recurrance needs to look up an state object, everything works well
except to keep within the hooks rules, i have to load the whole state into the component which has the recurring function using const state = useSelector(state => state)
then in the loop use const someVariable = state['someValue']
this works at the moment without issue, but i am concerned that as my appication grows so will the state, and i am concerned this is a bad idea as loading in a massive state could cause performance issues.
a few questions, is this a legit concern? or am i being overly causous?
one option would be to have all the objects related to this inside a base object mean i could only refence this part of state,however i don't think i can do this as they have seperate reducers and therefore have different state objects
the other is find a better was to select inside the the loop, but i don't know how to do that either, i know i can't use const selector = useSelector, because that throws the rules of hooks error
the state is used by multiple hooks, but the state isn't going to change without some user action
any thougths would be appriciated