Category "react-redux"

Handling Sessions & Idle Timer between multiple tabs in React SPA

I'm developing a React Application that has User Authentication with session duration. while login the response will give session duration with userObject. I'm

React Application <head> tag has the <script charset="utf-8" /> around 15 times. How can I reduce that? And why is it showing it so many times?

The <script charset="utf-8" src="/static/js/{chunkName}"></script> tag appears an incredible amount of times coming from different chunks. Why is th

Using the Context API as a way of mimicking useSelector and useDispatch with redux v5

I'm working on a React project where I'm constrained to using React Redux v5, which doesn't include useDispatch and useSelector. Nonetheless I really would like

Notistack enqueueSnackbar usage outside component

Is there any way to use enqueueSnackbar() outside the react component? For example, I want to show an alert on the service API request error. Api service reques

retrieve store data from react redux

I'm new to redux, I can't get data from the store.I get this message in the console: Error: Invalid hook call. Hooks can only be called inside of the body of a

(react redux toolkit) i want to know using action with multiple prameters

i recently started @reduxjs / toolkit. when i see code or documents of this, it not is not worked (undefined...) or too complicated(prepare?? createaciton??). i

reduxtoolkit mocking store with typescript

I found this code from redux documentation // test-utils.jsx import React from 'react' import { render as rtlRender } from '@testing-library/react' import { con

Redux-persist does not work with Redux-Toolkit

The app works fine The only thing is that redux persist is not working as it should.Persist doest not persist anything,it does not give any errors in the consol

React Navigation v5: How to navigate using redux thunk/redux saga?

How can I navigate the screen in react-navigation in Redux-Saga and Redux-Thunk? Is it possible to get access to the navigation context in sagas or thunk? For e

Upload Image with Axios Post request

I am trying to make a post request to an api to upload a user image and send it to the api for profile settings.But i always receive "the image field is require

Client-side jwt token storage

I need advice, what is the best way to store a JWT token? Should we store in cookies or storages? But with the CSRF flaw and xss attacks I have a doubt. I'm sti

Getting VS Code to detect React props properly when Redux state props are mixed in

There is a nice example in the React-Redux documentation on how to build a functional component that will receive both props from Redux and from its parent comp

Trying to get React Redux example in TypeScript to play well with VS Code

In the Redux documentation, there is an example that is not playing well with VS Code. I am talking about the example here: https://redux.js.org/usage/usage-wit

Redux store takes lil bit time to update store which causes else block to execute and hence get redirected to unintended page

//PrivateAuthComponent.js import React, { useEffect, useState } from "react"; import { useSelector } from "react-redux"; import { useRouter } from "next/router"

Using react dev tools inside iframe [In Chrome]

When react app is inside an iframe, dev tool chrome extension for react is not working. Refererd: https://github.com/facebook/react/issues/18945 Solution sugges

useSelector returns undefined - react-redux

I'm using react-redux. createSlice: import { createSlice } from "@reduxjs/toolkit"; const datatableSlice = createSlice({ name: "datatable", initialStat

How do I correctly implement Redux Saga action dispatches?

I'm currently playing around with redux saga and I'm having troubles implementing it correctly. Let's say I have a reducer which keeps track of how many times t

Unable to mock react-redux hooks after migrating to 8

I have been using the following pattern to mock react-redux hooks in tests that use Enzyme shallow rendering: import * as redux from "react-readux"; ... jest.sp

TypeError: undefined is not an object (evaluating 'state.selectedData.push') - Can't add payload to state using Redux Toolkit

I'm having an issue using Redux Toolkit. I want to push an object to my initial state called selectedData which is an array, this gives me the error "TypeError:

react reducer toolkit dispatch not working

I wrote profile page I want to get profile datas from api but my dispatch not working, in getProfileDetails function dispatch not working. import {createSlice}