title: How do I use persist/rehydrate in redux-toolkit?
body: <p>I've setup redux-persist with react-toolkit as suggested in the documentation. Now I need to do some operation on rehydrate ow do I do that? This is what I've tried but not working.</p>
  <pre><code>...
  import { REHYDRATE } from 'redux-persist'
  ...
  
  const accessControl = createSlice({
    name: 'accessControl',
    initialState,
    reducers: {
      loginStart(state: AccessControlState) {
        state.isLoading = true
      },
      loginSucces(state: AccessControlState, action: PayloadAction&lt;LoginResponsePayload&gt;) {
        state.isAuthenticated = true
        state.token = action.payload.access_token
        state.isLoading = false
        state.error = null
      },
      loginFailed(state: AccessControlState, action: PayloadAction&lt;string&gt;) {
        state.isAuthenticated = false
        state.token = ''
        state.isLoading = false
        state.error = action.payload
      },
      logout(state: AccessControlState) {
        state.isAuthenticated = false
        state.token = ''
        state.isLoading = false
        state.error = null
      },
      [REHYDRATE]: (state: AccessControlState) =&gt; {
        console.log('in rehydrate')
      }
    }
  })
  </code></pre>