Category "react-hooks"

how to use form data with custom hook in react js?

I have my custom axios hook, to send data without files it works perfectly, but when I send files it does not recognize any data. ...... const axiosFetch = asyn

How to make alert on click of button

Is there a way to make Alert on click not using the alert method but Alert tag. Currently I tried using usestate but didn’t work

Code with event handler using "functional state update" working perfectly in React 17 does not work properly in React 18

I have observed a very strange behavior of React 18 compared to React 17 and I am wondering what I am doing wrong (since React 18 was not supposed to "break" ex

When I try to push an element to a array but it takes only one rest of the elements are got removed automatically. It happen when use useState hook

const [filter, setFilter] = useState([]); let brandList = []; const handleCheckBox = (e) => { const { value, checked } = e.target; if (checked) {

how to Show All the users information from firebase to website

I am trying to show all the user's images on my react website. But I can only find the current user information using react-firebase-hooks/auth hooks. How can I

Unable to run unique iterations for individual objects

I'm trying to present 25 entries (name, company, skill, etc.) on the page and am having trouble getting the unique information. i.e. I only see the first entry

How to play sounds correctly?

I need to run sounds automatically in React. In order to run sounds, I use a non-standard useSound hook. It creates a button and by clicking on this button the

How to pass id in path url as component property in react router v6 [duplicate]

I'm updating an outdated tutorial project using react hooks and react router v6. I want to pass the id in the path url to the component proper

Can't combine a hook and a function in onClick event

I'm new to React. This is a 3 step registration form. In the last step - StepThree, I've been trying to have a hook - handleDateChange and a function - HandleUs

How can I obtain an image link that is in the body of my GET request using React.js?

I am using a spring boot backend with a react.js frontend for a web application. Once a user is logged in, it directs the user to their Profile where they will

Filter by date using React Hook

There are 2 methods of filter by date and by letters , they should work together and separately. 2.I thought I can combine them , but nothing happened and tried

How to handle React props correctly

I posted this here because I am relatively new to React and didn't know what exactly should I google. In my React project, I have a kendo grid that has a custom

Creating service in React Typescript using axios

There are two different ways to create a service and call from the required funtional component. 1. export const userProfileService = { ResetPassword: asyn

failed to get data from my contract using the navbar (web3 react hooks async function)

I'm trying to build My first react Dapp! The problem I encounter is the data doesn't load only when I'm refreshing the page instead of navigating with the navba

How does React hook handle dependency lists when passing objects to child components?

Parent component like this: function ParentComponent(){ return ( <ChildComponent data={{ x: 1, y: 2 }} /> ) } Child component like this: function

How do I call react function in js map?

I have the below code, the problem is in the part where I am calling the RemoveProduct function in the map function: function AddOrder() { const d = new Dat

Lazy initial state - What it is and how to use it?

I am new to react Hooks. Am trying to make use of useState in my code. While I was using it I found a term "Lazy initial state" https://reactjs.org/docs/hooks-

I'm trying to implement Infinite Scrolling in a React application using the IntersectionObserver API but i'm running into some issues

I'm trying to implement infinite scrolling and it's supposed to work by getting data in pages from the API...and then using the IntersectionObserver API, checki

Différence between only one state for variables or state for every one in react

If i'm having 3 variables to handle with useState in react is doing this: const [ user , setUser ] = useState({ name : '', phone : '', age : '' }) setUser({...

React state returns undefined when passed as object value

I want my id to be increased every time this function is executed,but when I console the object id returns undefined let [count, setCount] = useState(0); c