Skip to content
Advertisement

Tag: reactjs

Persist the login state in Next js using localstorage

I’m writing an authentication application in Next Js (v12.2.5). The application also uses React (v18.2.0). The problem is with persisting the authentication state. When the browser is refreshed, the login session is killed. Why is this happening even though I am getting and setting the token in the local storage. I would like to persist the login session to survive

React returns several errors when I import fetch

I am building a simple app using React. The app works fine without any issue until I import fetch. Here is the code I ran: App.js Some of the errors returned are: What I tried to resolve the errors are: Trying to substitute fetch with axios. But it seems to return the same errors. Adding experiments: { topLevelAwait: true }

SVG overlapping shapes with Recharts

I am using Recharts to create a simple pie chart. My issue likely stems from the fact the entire thing is SVG-based. I would like to have a selected pie slice change color (both fill and stroke). So I do the following: Then render with: And unfortunately, on hovering the First Slice, what I see is this: However, hovering the

Advertisement