Skip to content
Advertisement

Tag: use-effect

context.putImageData() Not working in React

Im trying to create a drawing application in react, its working for the most part. But when i try add an undo button it doesnt work. I try make the undo button with this finishDrawing() function, where i use getImageData and store it in an array called restore_array then when a Undo button is clicked i try to reload this

useEffect with many dependencies

I am trying to fetch employees and here is what I am trying to do using useEffect Here I want to achieve 2 goals: fetch adminEmployees if (adminEmployees===’unAuthorized’) then go to loginPage but when doing this as in the code, it creates infinite loop. How can I achieve the desired functionality? Answer Easy dirty path: split useEffect into 2 Better

Custom use effect comparator : ReactJS

I am having a state variable that is defined as follows where done has the following structure I want to run the useffect when some changes are made to the done and also values array under each object. In my case, useEffect gets triggered when I remove/add an objects to the done. But not when some changes happen inside values

UseState renders me the previous state

I have two inputs that change the text of a P tag at the same time, but the problem is that the render that shows me is always the previous value that was saved. I understand that I have to use a useEffect to render the component again and show the current value, but in the inputs handleChange if or

Advertisement