Skip to content

Instantly share code, notes, and snippets.

@NguyenDa18
Created March 4, 2022 07:05
Show Gist options
  • Save NguyenDa18/ee2b9108fb3c4ea2f8666f4c1fb59afe to your computer and use it in GitHub Desktop.
Save NguyenDa18/ee2b9108fb3c4ea2f8666f4c1fb59afe to your computer and use it in GitHub Desktop.
Redux TS Setup
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