josealejandro2928 / react-image-picker-editor

React library for the selection, edition and compression of images in png, jpeg and webp formats This package is made completely with html and css without any extra components or npm packages. It's based in functional components based in hooks, for optimization were used memo, useMemo and useCalback for avoiding any extra-renders.
https://www.npmjs.com/package/react-image-picker-editor
MIT License
27 stars 21 forks source link

`imageSrcProp` set on load from web url but it's going in loop as I have array of Image #7

Closed salmangetmee closed 3 months ago

salmangetmee commented 7 months ago

hi,

there is problem of image loading again and again. Let me explain the scenario. i have a array of Object in which user can add new Object and Remove any Object. that Object has 3 properties. title, description and Icon (for Image). now we I load the Initial data if user has set them the array is looping and setting the image in imageSrcProp which call's the method imageChanged and there I am updating the state value which is causing the re-render in react. So it's just loading image again and again.

image

This is the code it's inside map function image

josealejandro2928 commented 5 months ago

Trying using memo for not reseting the state on the component