Skip to content

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