How to persist Redux authentication state using cookies for protected routes after page reload?
I have a MERN stack application with the following setup:
How to persist Redux authentication state using cookies for protected routes after page reload?
I have a MERN stack application with the following setup:
Too many state variables in a reducer, but I want my component to render only when one of them changes
I created a reducer with many state variables,
React component re-rendering issue with redux-toolkit
I created a component –
How do I use a Provider in React properly?
The problem is that if I use a Provider in my index.js, all my components disappear.
problems with Redux
The problem is that if I use a Provider in my index.js, all my components disappear.
Authentication – Login form with remember me option
I have one question about Authentication part – actually I have login form with remember me checkbox, I am confused, from backend I get accessToken,refreshToken and refreshTokenExpiration, how need to handle it when I click remember me, when I don’t click rememberMe? Where I need to save that tokens which I get? I read storing tokens in localStorage is not secure. I use React, redux toolkit.
How to tell if thunk created using createAsyncThunk is pending inside react component?
I have a bit of react code that dispatches an thunk created using the createAsyncThunk from rtk, when a button is clicked. The API call is slow, so I would like to display a loading indicator while the thunk is dispatching.
Error with redux that state.items is undefine [closed]
Closed 1 min ago.
hi everyone, i have an error with redux that state.items is undefine
import { createSlice } from “@reduxjs/toolkit”; export const cartSlice = createSlice({ name: ‘cart’, initialState: { items: localStorage.getItem(‘cart’) ? JSON.parse(localStorage.getItem(‘cart’)).items : [] }, reducers: { addToCart: (state, action) => { // kiểm tra thử sản phẩm đó đã tồn tại chưa nêu chưa thì thêm , nếu có rồi thì tăng số lượng if (state.items.find((item) => […]