Questions tagged [redux]

Redux is a pattern and library for managing JavaScript application state, using events called "actions". It serves as a centralized store for state that is needed across your entire application, with rules ensuring that the state can only be updated in a predictable fashion. Redux make it easier to understand when, where, why, and how the state in your application is being updated, and how your application logic will behave when those changes occur.

Redux is a pattern and library for managing and updating application state, using events called "actions". It serves as a centralized store for state that needs to be used across your entire application, with rules ensuring that the state can only be updated in a predictable fashion. It is inspired by the architecture.

The patterns and tools provided by Redux make it easier to understand when, where, why, and how the state in your application is being updated, and how your application logic will behave when those changes occur. Redux guides you towards writing code that is predictable and testable, which helps give you confidence that your application will work as expected.

Redux Toolkit is the standard approach for writing Redux logic. It provides utilities to simplify several common Redux use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state at once


Useful Links

Related tags

35457 questions
7
votes
8 answers

how do I enable Debug JS Remotely in React Native?

To debug redux, I use React Native Debugger, but for this you need to enable Debug JS Remotely. I don't have this tab in the developer menu. I use redux, redux-toolkit, redux-saga. photo: https://i.stack.imgur.com/jrX4b.png
Krilpil
  • 105
  • 1
  • 7
7
votes
4 answers

TypeError: Cannot read properties of null (reading 'useMemo')

Am getting "TypeError: Cannot read properties of null (reading 'useMemo') error Redux in my react redux application. I made a very simple react redux application. but am keep getting this error. searched about this error on Internet unfortunately…
Keerthan Achar
  • 79
  • 1
  • 1
  • 6
7
votes
1 answer

Dispatch with multiple parameters and create action with Redux Toolkit

I'm fairly new to Redux (and especially Redux Toolkit) and cannot wrap my head around the following issue. I'm rewriting old code with Toolkit. I understand that I can do the following in my createSlice. reducers: { changeDay: (state, action)…
user18046260
7
votes
2 answers

'Provider' cannot be used as a JSX component

I've recently updated my react-router-dom to v6. The new version is very strict about the types used. When I use a redux provider in my code I get the following error message: TS2786: 'Provider' cannot be used as a JSX component. But it is fine for…
pesehr
  • 787
  • 2
  • 9
  • 23
7
votes
0 answers

Are concurrent queries via same endpoint possible using useLazyQueryHook in Redux Toolkit

The problem: When doing multiple requests to the same endpoint, useLazyQueryHook will return a response only with the latest query with status set to 'fulfilled' and response data, while other requests made before are stuck with status 'pending'…
Olafur Kari
  • 103
  • 4
7
votes
0 answers

In Typescript, how do I pass a generic to an indexed access type?

I am doing some refactoring of a redux store, and I wanted to create a "Factory" type that could be used to reduce duplicate code. Currently, I have it as: interface CommonFactory { Payload: Partial; Action: Action & { payload:…
7
votes
1 answer

Should I put RTK Query results into the store?

Trying to understand RTK Query and how to use it optimally in a React app. I have a Search component in one part of my application. When a search is executed, I want the results to appear in another area, far away in the component tree. All the…
doggie
  • 79
  • 1
  • 6
7
votes
3 answers

In jest : "could not find react-redux context value; please ensure the component is wrapped in a "

I get this error when trying to execute simple Jest test with a form React component : ● › clicking the validate button › should display page title …
Lou
  • 148
  • 1
  • 12
7
votes
1 answer

How can I use redux and graphql with apollo client in the same react app?

I'm working on a project, and I'm using apollo/client, graphql in react, and for the global state management, I have to use redux. I'm quite sure I'll have to handle more data in my project so I'll put it in my store. I'm wondering about how can I…
Sara Ghali
  • 73
  • 1
  • 5
7
votes
2 answers

Custom middleware causes a circular reference in redux

I am trying to convert a redux project to typescript using the provided documentation: https://redux.js.org/usage/usage-with-typescript#type-checking-middleware However I'm having trouble doing it with my custom middleware. Here is the minimized and…
Algirdyz
  • 607
  • 6
  • 16
7
votes
3 answers

Redux Toolkit doesn't work well with WebStorm

I'm learning Redux and Redux Toolkit, but I don't understand why autocomplete doesn't work when I'm trying to dispatch an action (see the image below). I imported the "action" but WebStorm can't see any methods. On VSCode it works very well. Here…
Yannick
  • 75
  • 6
7
votes
3 answers

Input field losing focus on each character type - react

I am trying to add column filter on the header of the table but after each input typing on the field, it is losing the focus. My main component: Here, I have initialized a local state: searchColArr and all others state used in fetchData are the…
Aayush Dahal
  • 856
  • 1
  • 17
  • 51
7
votes
1 answer

Is safe to insert 'dispatch' function as a dependency in useEffect function?

If I use this useEffect(() => { dispatch(fetchToDos())}, [debouncedToDo, loginInfo.isLogin]) I get this warning React Hook useEffect has a missing dependency: 'dispatch'. Either include it or remove the dependency array …
George Hutanu
  • 139
  • 1
  • 5
7
votes
2 answers

Why Context API is worse than Redux for high frequency updates?

I saw many articles that Redux is better than Context API in performance than high frequency updates, but nothing is specific and tell why. What makes people say Redux is better than Context API for high frequency updates?
lcpnine
  • 477
  • 1
  • 7
  • 16
7
votes
0 answers

How to fix "EISDIR: illegal operation on a directory, read error" on react native android emulator with react native debug mode enabled

I am new to React and React Native and I am stuck with debugging process. I have used redux and want to check the action and state changes in the redux debug tool. Following steps I have followed: Installed Redux DevTool extension in…
Gaurav Khatri
  • 387
  • 3
  • 11