I followed the guideline to setup react-images-uploading.
Below is the code where the problem occurs -
const ImageAdd = ( { getImg } ) => {
const [ images, setImages ] = useState( [] );
const maxNumber = 1;
const onChange = ( imageList, addUpdateIndex ) => {
// data for submit
console.log( imageList, addUpdateIndex ); // here it shows the image info
setImages(imageList);
console.log(images); // here it shows empty array
};
}
SS added.
Also I wanted to pass this array to a parent component , from where getImg function comes from. Due to images state being empty it sends undefined . And I have no idea how to access imageList array.
I followed the guideline to setup react-images-uploading. Below is the code where the problem occurs -
SS added.
Also I wanted to pass this array to a parent component , from where getImg function comes from. Due to images state being empty it sends undefined . And I have no idea how to access imageList array.