Category "reactjs"

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

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

React native expo web page refresh from chrome browser

ima having a react native web app and when i refresh the page from browser, it navigates to my apps homepage. is there any way that could fix that issue. it ha

React native expo web page refresh from chrome browser

ima having a react native web app and when i refresh the page from browser, it navigates to my apps homepage. is there any way that could fix that issue. it ha

How to avoid act() with sub component changes?

I'm using the Select component from patternfly and attempting to do a test that involves making changes to the selection. I feel like I'm in a catch 22 as I can