TypeError: (0 , _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createAsyncThunk) is not a function

774 Views Asked by At

Suddenly had this error after (it seems..) trying to deploy my client to Vercel.

I'm using NextJS and I'm fetching data server side with getStaticProps.

Tried reinstalling toolkit but the problem persist.

import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";

What could possibly be wrong ?

if it matters, here's how I use createAsyncThunk in my slice :

    export const countProducts = createAsyncThunk(
    "products/countProducts",
    async (undefined, { getState }) => {
    const { filterBy } = getState().product;
    const url = `${process.env.STRAPI_URL}/products/count?categories.name_contains=${filterBy}`;
    const { data } = await api.get(url);
    return data;
  }
);

Any help would be GREATLY appreciated.

1

There are 1 best solutions below

0
On

Fixed it, I just somehow had an older version of toolkit installed (v1.2.x).