title: Create Dynamic Url at Redux Toolkit
body: <p>I have an initialState and a dynamic URL and async thunk for axios</p>
  <p>I want to change URL query parameter according to a key in initial state.</p>
  <pre><code>?query=${initialState.category}
  </code></pre>
  <p>category changes but URL fetches data with unchanged category (it uses initial key not modified key)</p>
  <pre><code>const initialState = {
    category: &quot;burger&quot;,
    products: [],
    isLoading: true,
    categories :{
      burger:&quot;burger&quot;,
      kebab:&quot;kebab&quot;,
      chicken:&quot;chicken&quot;,
      pizza:&quot;pizza&quot;,
      fish:&quot;fish&quot;,
      vegan:&quot;vegan&quot;,
      salad:&quot;salad&quot;,
      pasta:&quot;pasta&quot;,
      steak:&quot;steak&quot;,
      dessert:&quot;dessert&quot;,
      waffle:&quot;waffle&quot;
  }
  
  };
  
  const url = `https://api.spoonacular.com/food/menuItems/search?query=${initialState.category}&amp;number=10&amp;apiKey=API_KEY`;
  
  export const getProducts = createAsyncThunk(
    &quot;products/getProducts&quot;,
    async (_, thunkAPI) =&gt; { 
      
      try {
        const response = await axios(url);
        console.log(response);
        return await response.data;
      } catch (error) {
        return thunkAPI.rejectWithValue({ error: error.message });
      }
    }
  );
  
  export const productSlice = createSlice({
    name: &quot;product&quot;,
    initialState,
    reducers: {
      pickCategory: (state, action) =&gt; {
        state.category = action.payload;
      },
  </code></pre>