redux-thunk Questions

3

Solved

I am currently trying to conceptualize how to handle dispatching an action in a component based on a data change after a dispatch in another component. Take this scenario: dispatch(someAjax) -> p...
Showboat asked 11/4, 2016 at 19:2

13

Solved

I'm trying to apply redux in my reactjs app. I can't proceed because of these errors: I'm sure that I already installed all the dependencies that I need. Here is a relevant part of my package....
Elkeelkhound asked 22/10, 2017 at 1:28

4

Solved

I have come across Redux Toolkit (RTK) and wanting to implement further functionality it provides. My application dispatches to reducers slices created via the createSlice({}) (see createSlice api ...
Graphophone asked 20/2, 2020 at 9:6

9

This error occurred when I connect actions to extraReducers My code is export const fetchCountries = createAsyncThunk( `country`, async (organizationId: string) => { export const saveCountry...
Align asked 14/7, 2021 at 9:24

5

I am currently setting up my RTK (Redux Toolkit) and did some minor testings. Here's my code: store/index.js import { configureStore } from '@reduxjs/toolkit' import { loginSliceReducer } from './v...
Unwarrantable asked 20/7, 2020 at 5:10

2

I'm trying to dispatch an action when the user submits a form. Let's say I have a submit button that triggers an onSubmit event on the form (and eventually will show a spinner icon while the form r...
Able asked 30/11, 2017 at 2:9

2

Solved

I just started on redux yesterday and after reading up on the different libraries, I decided to use the slice route from RTK. For my async, instead of using createAsyncThunk, I decided to use RTK q...
Maryleemarylin asked 6/6, 2021 at 5:13

15

Solved

store.ts export const store = configureStore({ reducer: { auth: authReducer }, middleware: [], }); export type AppDispatch = typeof store.dispatch; export type RootState = ReturnType<typeof...
Endolymph asked 28/11, 2021 at 13:21

3

Solved

I am getting a getDefaultMiddleware is deprecated warning after updating "@reduxjs/toolkit": "^1.6.1" So how should I remove this warning. Do we have any other way to inject def...
Sememe asked 22/7, 2021 at 5:30

3

Solved

I have set up a redux thunk function with typescript like this: export const fetchActivities = (): AppThunk => async dispatch => { dispatch(fetchActivitiesRequest()) try { const res = aw...
Conduce asked 4/2, 2020 at 1:47

2

I am building an app using react native that requires me to do multiple get request on same API with token. Let say the URL is like this: Token URL = https://test.co/v1/tokens, API URL 1 = https://...
Magnesite asked 15/11, 2017 at 8:34

6

Solved

Say I have code like so: import { Action, Dispatch } from 'redux'; import { ThunkAction } from 'redux-thunk'; interface StateTree { field: string; } function myFunc(action: Action | ThunkAction...
Ladysmith asked 25/3, 2017 at 6:15

13

Solved

According to the docs, "Without middleware, Redux store only supports synchronous data flow". I don't understand why this is the case. Why can't the container component call the async API, and then...
Herve asked 2/1, 2016 at 21:9

3

Solved

I am migrating over from Redux to Redux Toolkit. The simplified code I have here is for debounced update using lodash/debounce. import debounce from "lodash/debounce"; const updateApplic...
Pneumococcus asked 7/7, 2021 at 7:31

3

I have 2 actions, and I call from the first action to the second action .... and I need to wait until the second action is finished and only then continue with the action. // first action export co...
Ensoul asked 1/9, 2020 at 11:37

3

I've got a simple component that calls an action when a user loads a page, and inside that action, I'm trying to dispatch another action to set the loggedIn state of the store to true or false: im...
Bouie asked 6/4, 2016 at 21:2

7

Solved

I have one piece of middleware already plugged in, redux-thunk, and I'd like to add another, redux-logger. How do I configure it so my app uses both pieces of middleware? I tried passing in an arr...
Gahan asked 13/5, 2017 at 16:3

11

Solved

There is a lot of talk about the latest kid in redux town right now, redux-saga/redux-saga. It uses generator functions for listening to/dispatching actions. Before I wrap my head around it, I wou...
Friseur asked 21/1, 2016 at 17:45

5

I'm quite new to Jest and admittedly am no expert at testing async code... I have a simple Fetch helper I use: export function fetchHelper(url, opts) { return fetch(url, options) .then((respon...
Flashboard asked 9/1, 2018 at 16:40

6

Solved

I cannot set the return type of getState() to RootState. I'm using typescript and VSCode. I have to set the type to any, which stops IntelliSense on that object. Below is the code that has the prob...
Pyles asked 11/11, 2020 at 20:13

4

Solved

I have a React App, I need to make an ajax call (in order to learn) to a online service (async) with Redux. This is my store: import { createStore, applyMiddleware } from 'redux'; import thunk fr...
Berenice asked 20/2, 2016 at 23:51

4

I tried all the commands for redux but it doesn't work:how do you think the solution is. These are the commands I tried yarn add react-redux yarn add reduxjs / Redux-thunk#master npm install --sav...
Existence asked 12/2, 2020 at 21:14

2

I am facing error with using redux toolkit with next js. I facing this lagacy warning- /!\ You are using legacy implementaion. Please update your code: use createWrapper() and wrapper.useWrappedSto...
Sunbeam asked 18/9, 2022 at 8:39

3

Solved

I am making a react app (not react-native) using React-v17, and react-redux V7, and React Router V6, searching and reading many articles, I could not find a way to navigate programmatically inside ...
None asked 31/1, 2022 at 15:11

1

Solved

I'm learning about RTK Query and really confused. I'd be happy if someone could point me towards the right direction. My question is how one can manipulate the state of the application store the sa...
Forster asked 8/8, 2022 at 15:58

© 2022 - 2024 — McMap. All rights reserved.