title: How to share data between two slice reducers redux toolkit
body: <p>I have two slice reducers and I want to get the state of one to the other.
  In the old way of redux I would do it like that:</p>
  <pre><code>import store from &quot;store&quot;
  
  ///reducer code
  
  const state = store.getState();
  
  </code></pre>
  <p>Now Iam using redux-toolkit and this way of importing store doesnt work.</p>
  <p>here is LoginSlice:</p>
  <pre><code>
  import { createSlice } from '@reduxjs/toolkit';
  import axios from &quot;axios&quot;
  import Swal from 'sweetalert2'
  
  export const initialState = {
          id: &quot;1111&quot;
  }
  export const LoginSlice = createSlice({
    name: 'login',
    initialState,
    reducers: {
      login: state =&gt; {
         state.id = &quot;2222&quot;
      },
  },
  });
  
  
  export const { login} = LoginSlice.actions;
  
  
  </code></pre>
  <p>here is Sites slice :</p>
  <pre><code>import { createSlice } from '@reduxjs/toolkit';
  import axios from &quot;axios&quot;
  
  
  export const SitesSlice = createSlice({
    name: 'sites',
    initialState: {
      sites: []
    },
    reducers: {
      GetSites: (state,action) =&gt; {
  
          axios.post(process.env.REACT_APP_API_URL+&quot;/sites/get&quot;,{id: get id here}).then((err,data) =&gt;{
            if(data.data.success){
              state.sites = data.data.data
            }else{
              error
            }
        })
        .catch(error =&gt; {
           error
        })
    }
  },
  });
  
  
  export const { GetSites } = SitesSlice.actions;
  
  
  </code></pre>
  <p>here is the store:</p>
  <pre><code>
  import { configureStore } from '@reduxjs/toolkit';
  import { combineReducers } from 'redux'
  import loginReducer from '../features/Login/loginSlice';
  import siteReducer from '../features/Sites/SitesSlice';
  
  const reducer = combineReducers({
    login: loginReducer,
      sites: siteReducer,
  })
  
  export default configureStore({
    reducer
  });
  
  </code></pre>
  <p>what I want to do is to get the user id from the logIn Slice to the Sites Slice.
  something like <code>store.getState().logIn.user.id</code></p>
  <p>I am having trouble with this );</p>