Problem with redux-toolkit (createAsyncThunk) in react native expo app
Hello and thank you in advance for your help.
My problem is on redux-toolkit on a react-native application with Expo. To put you in the context I am quite a beginner.
Here is my code :
export const fetchStationsInformations = createAsyncThunk(
"stations/fetchStationsInformations",
async () => {
console.log(process.env.NODE_ENV);
if (process.env.NODE_ENV === "test") {
return require("@data/stationsInformations.json");
}
const response = await api.get("/stationsInformations");
return response.data;
}
);
export const fetchStationsStatus = createAsyncThunk(
"stations/fetchStationsStatus",
async () => {
console.log(process.env.NODE_ENV);
if (process.env.NODE_ENV === "test") {
return require("@data/stationsStatus.json");
}
const response = await api.get("/stationsStatus");
return response.data;
}
);
I would like to understand why, when in the above code when I let I have in my file the functions fetchStationsInformations and fetchStationsInformations I get this error :
ERROR [Error: Exception in HostFunction: Compiling JS failed: 2:20:invalid expression Buffer size 613 starts with: 5f5f642866756e6374696f6e28676c6f and has protection mode(s): rw-p]
While the method fetchStationsStatus is not used and fetchStationsInformations used. I try to clear cash with "expo start --clear".
But if I delete the fetchStationsInformation method then it works. I have looked at a lot of documentation and stackoverflow but I can't find a solution.
Thank you!
Comments
Post a Comment