Created
March 4, 2022 07:05
-
-
Save NguyenDa18/ee2b9108fb3c4ea2f8666f4c1fb59afe to your computer and use it in GitHub Desktop.
Redux TS Setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { configureStore } from '@reduxjs/toolkit' | |
export interface AccountState { | |
readonly isInitialized: boolean | |
readonly isLoading: boolean | |
readonly isAuthenticated: boolean | |
readonly errorMessage?: string | |
} | |
/** | |
* Import state slices | |
* ---- | |
* Import slice reducer and add to `configureStore` reducers | |
* Import slice types and add to `State` interface | |
* Import slice actions and spread with `actions` export | |
*/ | |
export interface State { | |
readonly account: Account | |
readonly app: App | |
} | |
export const actions = { | |
...accountActions, | |
...appActions | |
} | |
/** | |
* Configure store | |
*/ | |
export const store = configureStore({ | |
reducer: { | |
account, | |
app | |
}, | |
devTools: true | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment