title: Redux toolkit: Have two slices reference each other's actions in extraReducers?
body: <p>I would like two different slices to cross-reference each other's actions like so:</p>
  
  <pre><code>const sliceA = createSlice({
      name: "sliceA",
      initialState: null,
      reducers: {
          someReducer: (state, action) =&gt; {
              // do something
          },
      },
      extraReducers: {
          [sliceB.actions.anotherReducer]: (state, action) =&gt; {
              // do something
          },
      },
  });
  
  const sliceB = createSlice({
      name: "sliceB",
      initialState: null,
      reducers: {
          anotherReducer: (state, action) =&gt; {
              // do something else
          },
      },
      extraReducers: {
          [sliceA.actions.someReducer]: (state, action) =&gt; {
              // do something else
          },
      },
  });
  </code></pre>
  
  <p>The problem is that I receive the error that sliceB is undefined when trying to set the extraReducers for sliceA.</p>
  
  <p>I would like to keep the slices separate for clarity, but that <em>some</em> of their actions affect each other. </p>
  
  <p><strong>What is a good way to achieve that?</strong> </p>