Category "redux"

Using redux toolkit in NextJS without next-redux-wrapper

I'm new to NextJS and I'm trying to figure out on how to implement RTK, I stumbled on this github repo example from Jack Harrington and basically his slices has

File Upload with axios using redux

Currently, I'm able to test a file upload function. and that looks like this const handleFileUploadSubmit = (event) => { event.preventDefault() const

Flex direction changes when I use persist gate(next js with redux)

I am using next js and redux to build an app. When I use in my _app.js the flex direction changes in index.js, from row to column. No changes in the CSS or in

Creating a createSelector in Redux that does not rerender unrelated components

I have a simple document maker that allows users the create multiple fields of two types (input field and label field). They can also rearrange the field via dr

Jest tests breaks when calling getState outside a component in React

A bunch of my tests suddenly started breaking when I use store.getState() inside a function in React. If I log the store, the store exists but it is still break

spread operator vs immutable.js

It seems like when using redux with react, immutable.js has become almost a industry standard. My question is, aren't we making changes to our redux states immu

Redux toolkit filter() not working when wanting to display new array at the same time

I am currently building a clothing shop in which you can add products to the cart, and delete each one of them as you like and it makes the cart re-render and d

Wait for previous dispatch action to complete

const onFeedSubmit = async (data: PostFeedActionProps) => { try { setPostingFeed(true); selectedBusinessList.forEach(business => {

Redux store data being reset upon "getServerSideProps" being called; not persisting

Overview: I have a TypeScript NextJS project that I am using Redux-toolkit with to manage state. My file structure for my Redux store and pages are as follows:

How do I unsubscribe to the dispatch to grab new data onload on useEffect? - I'm using Redux Toolkit

I can load my data but only after I refresh the page. Until then, it shows the data from the previous item I clicked on. It's behaving like a cache would. Here

making post request with createAsyncThunk redux toolkit

Following is my reduxtoolkit code. I am trying to post data but it is giving me 422 error. The response says spot_id and item_id required but I am sending it. A

React-Typescript: Module '"react-router-dom"' has no exported member 'RouteComponentProps'

I have a project and with this project I have a login page and I want to use "RouteComponentProps", but I got this error: Module '"react-router-dom"' has no exp

React Redux Problem: How to call multiple api in your react component with React Redux Toolkit RTK queries?

Hope you all are doing fine. RTK queries return response in data attribute which can be accessed via hook generated by RTK My Code: const {data = [], isFetching

Persist-reducer function giving type error to my reducer in typescript

I am trying to configure react-persist in my typescript react application. The persistReducer function is giving a type error to my reducer that Argument of typ

One component affecting another in reactjs

Every url loads three main components: Left panel, center and right panel. In right panel, we have a button which returns a sub-component CreateForm inside the

An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft

I understand this has been asked before but so far no answers except someone making a syntax mistake. I have verified this against every tutorial I've seen onli

cant access state, react redux

I have a page with notes for a specific user, the problem is when i'm trying to access the state of 'my notes' i get 'undefined' on console, in postman, everyth

How to use redux in Next.js?

I am new to Next.js, So I follow some tutorials for Redux integration in Next.js. All is working fine but whenever I switch between pages, each time API make a

Cannot update a component while rendering a different component warning

I am getting this warning in react: index.js:1 Warning: Cannot update a component (`ConnectFunction`) while rendering a different component (`Register`). To l

Error: Request failed with status code 500 but it works after I refresh the page

When I run my Next.Js/MongoDB Project for the first time it always greets me with a "Error: Request failed with status code 500", but after I refresh the page i