Category "reactjs"

Where is the user data stored after decoding it from the token?

Where is the user data stored after decoding it from the token? I'm using react , and the Jwt token is stored in local-storage .

How do I fit the entire content in one page when printing it to PDF?

I am using jspdf and html2canvas. Printing the component would make the footer go to the next page. How can I set this where it will dynamically resize to fit i

A problem that i am having making conway's game of life in react (nextjs). when i press the Random button while it is running, it starts flickering

Here is a the code for you to try. both button works fine while the game is paused or running very fast, but if i set the timeout above 100 or 200 ms and the ga

A problem that i am having making conway's game of life in react (nextjs). when i press the Random button while it is running, it starts flickering

Here is a the code for you to try. both button works fine while the game is paused or running very fast, but if i set the timeout above 100 or 200 ms and the ga

React useEffect does not work as expected

useEffect(() => { const method = methodsToRun[0]; let results = []; if (method) { let paramsTypes = method[1].map(param => param[0

Why do clicks within Popover.Panel close the panel when within Tab.Panel?

I've been using @headlessui/react for a project and it's helped me be very productive! But I've found an issue where one component interferes with another. I th

A component is changing an uncontrolled input to be controlled

I am trying to do the discounted price logic Discount price should have the default value of actual price , because 0% discount means the discount price is same

React state management rendering for one object or array of objects

I'm learning React and starting with handling state in a CRUD form via the useState Hook. Something like this: const [data, setData] = useState({}); where data

Parsing error: require() of ES Module not supported

I was coding and out from nothing I'm getting this error and I don't know what to do. I've tried everything on stackoverflow and other sites already and nothing

Next.js is not recognizing '@types/react'

When I try to run my Next.js app with npm run dev I get an error message saying that I don't have the required packages to run Next with Typescript: Please inst

How to convert Devextreme React sample code to uses React 18?

DevExtreme React sample application uses ReactDOM.render that was deprecated on React 18. I converted the code to use ReactDOM.createRoot but the webpage is not

entered value only shows in console reactjs

I'm making an expense handler app using reactjs in a practical course. Now, I'm supposed to make a new row with the data I'm passing through form. But it only s

React-router-dom v6 params

How do I create a route in react using react-router-dom v6? Currently I'm trying: <Route path="/registration:id" element={<Registration />} /> With

React-router showing invalid hook call

An invalid hook error occurred in my react app caused by react-router but I can't seem to detect where it's coming from. The full error reads as follows: Error:

Getting "...'editorState' does not exist on type 'IntrincsicAttributes

I'm working on a post section on my webapp and I decided to use react-draft-wysiwyg. Everything was working fine up to the point where I set editorState={editor

Target map()'ed items one by one

I want to create a contact form where the form fields are changed after they are filled. For example when you fill the email field, you press enter or click the

npx create-react-app show error when installing

npx create-react-app shoing eror whent installing, please help me how to solve this problem. my nodejs version is v16.14.2 and npm version is 8.5.0 Installing p

How to send a image jpg/png file from react to express server

I am trying to send an object from react to express server using node.js this is my object: const formData = { location: location, cost: cost, email

Use both enzyme and react-testing-library

So, we started implementing testing in our app, I used enzyme and my coworkers used react-testing-library. Of course the setupTests.js file is different so eith

How can i add React loading spinner when item is fetching from database?

Here is, my code. i want to add a spinner when data is loading then after finish loading display the data. {/* product section */} <section className="c