redux-thunk Questions

1

Solved

With Redux RTK I'm getting this error "non-serializable value was detected in an action", however I just have Date's here, and they are serializable right? So wondering why this is? ...
Kwasi asked 29/7, 2022 at 0:55

5

Solved

I am trying to chain dispatches with redux thunk function simple_action(){ return {type: "SIMPLE_ACTION"} } export function async_action(){ return function(dispatch, getState){ return dispatch...
Alkalinize asked 28/1, 2016 at 18:27

7

Solved

The useHistory() hook is not working in my project. I have it in different components but none of them work. I am using "react-router-dom": "^5.2.0", import {useHistory} from 'r...
Newsom asked 1/8, 2021 at 19:4

3

Solved

I can't seem to receive a Promise from createAsyncThunk function from Redux-toolkit I'm fairly new to Typescript and I'm struggling to figure out why it's giving me Property 'then' does not exist o...
Epilepsy asked 9/9, 2020 at 12:9

2

Solved

Right now I've got these actions that I use for an upload thunk's lifecycle. type UPLOAD_START = PayloadAction<void> type UPLOAD_SUCCESS = PayloadAction<{ src: string, sizeKb: number }>...
Antemundane asked 23/4, 2021 at 9:2

2

Solved

I am struggling to figure out what the return type should be for my action. Everything works whilst I am using any but am trying to avoid using any. export const saveValue = (value: number): any =...
Jiminez asked 11/6, 2018 at 9:6

1

They propose to use subscribe for vanilla Redux here: Where to write to localStorage in a Redux app? Here for Redux Toolkit he propose to sort out local storage write operation in a separate thu...
Astarte asked 9/6, 2022 at 5:57

1

Solved

Error: Argument of type '(dispatch: Dispatch<ShopDispatchTypes>) => Promise<void>' is not assignable to parameter of type 'AnyAction'. useEffect(() => { dispatch(GetShops()); }, ...
Huckster asked 26/5, 2022 at 18:14

1

Solved

Problem I am using Redux Toolkit and TypeScript to create a Todos app. I want to create middleware that will listen for a dispatched action so I can then dispatch async actions. What I have so far ...

1

Solved

I'm trying to set the initial state of my contactSlice.ts with an async function using RTK Query. I've read the docs and searched online but I didn't find a suitable solution for this problem. cont...
Tuck asked 23/4, 2022 at 10:11

0

I'm trying to dispatch a thunk on a first render of the page and on a button click. Here's a sample code of it: export default function App() { const [loading, setLoading] = useState(false); cons...
Mcmillin asked 21/4, 2022 at 14:35

7

Solved

I am new to react/redux. I am trying to figure out how all the pieces in redux interact. The one thing giving me trouble is understanding the relation between actions and reducers,store.
Vedette asked 27/1, 2019 at 5:24

3

Solved

I'm using Redux Toolkit with the thunk/slice below. Rather than set the errors in state, I figure I could just handle them locally by waiting for the thunk promise to resolve, using the example pro...
Steiermark asked 6/6, 2020 at 21:40

2

Solved

I'm using redux-thunk to use async action creators. The result is also returned to the respective caller. function fetchUserName(userId: number): Promise<string> { return Promise.resolve(`U...
Bossy asked 18/1, 2020 at 13:10

5

action.js export function getLoginStatus() { return async(dispatch) => { let token = await getOAuthToken(); let success = await verifyToken(token); if (success == true) { dispatch(loginSta...

5

Solved

I'm aware that if you throw a SubmissionError from your handleSubmit() function, the redux-form code will fill in the errors of the appropriate fields and/or the form itself. Yet that API of setti...
Wormwood asked 7/2, 2017 at 8:37

1

Solved

I'm rather new to the whole React & Redux ecosystem & am trying to understand when & why to use extra reducers vs directly dispatching actions within an async thunk when working with th...
Tshirt asked 11/1, 2022 at 8:24

2

Solved

I'm using RTK (redux-toolkit) inside a Next.js App. And I'm trying to dispatch an AsyncThunk Action inside "getInitialProps". When searching I found a package called "next-redux-wrap...
Bromeosin asked 20/12, 2021 at 19:23

3

Solved

I am having trouble with dispatching a redux-thunk action using Typescript. import { AnyAction, applyMiddleware, createStore } from 'redux' import thunk, { ThunkAction } from 'redux-thunk' interfa...
Weighted asked 16/11, 2020 at 12:16

4

I have found similar issues online but no solution for when calling a redux-thunk Action through store.dispatch(). I have the following action: export class DBActions { static startDatabase(): T...
Anglicism asked 25/1, 2019 at 18:38

1

Solved

I am using Redux Toolkit (RTK) and Redux Toolkit Query (RTK-Query). Is it best practice, necessary, or advised in any scenario to still use thunks, or should I move all logic into components? (like...
Aylward asked 9/9, 2021 at 14:9

6

Solved

All around it but not quite as I have enough of an idea of redux-thunk and of react-router but I am not getting this seemingly simple idea of: Call a change in route programmatically via <Route...
Chiquia asked 30/11, 2017 at 3:24

2

So recently I am working on a react native app. I did wonder how I navigate from a fullfiled action? I did not find away to be able to do that. What i have so far is this: Dispatch Action Navigate...
Janeanjaneczka asked 13/8, 2021 at 2:55

2

Solved

I am using redux-toolkit with createAsyncThunk to handle async requests. I have two kinds of async operations: get the data from the API server update the data on the API server export const up...
Coquetry asked 21/8, 2020 at 4:52

3

Solved

I know I shouldn't be trying to dispatch thunks from sagas, it goes against what redux-saga tries to do. But I'm working in a fairly large app and most of the code is made with thunks, we are migra...
Sylvester asked 2/6, 2017 at 16:59

© 2022 - 2024 — McMap. All rights reserved.