Redux migration - state management doubt #7397
Replies: 1 comment
-
selected accounts are client state - they have nothing to do with a sever resource, so you shouldn't be managing this with react query. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
is there a way to use a simple function to set selected accounts using React Query? this is what I have using redux, I need something similar and be able to read selectedAccounts from anywhere in the code
const setSelectedAccounts = React.useCallback(
(selectedAccounts: Account[]) =>
dispatch({ type: ActionTypes.SELECT_ACCOUNTS, payload: selectedAccounts }),
[dispatch],
)
case ActionTypes.SELECT_ACCOUNTS:
return { ...state, selectedAccounts: action.payload, loading: false, error: false }
Beta Was this translation helpful? Give feedback.
All reactions