![]() We pass an empty dependencies array to useEffect, so that it is called only once in the component’s lifetime, and the resize event listener is only registered once – when the component first renders. You can simply use the addEventListener() method to register an event handler to listen for the browser window resize event, such as window.addEventListener(. (B2) When the image is fully loaded, we calculate the new dimensions and draw the resized version onto the
0 Comments
Leave a Reply. |