I use react image slider image slider
The issue is that when i store images paths like it's in code example it works ok
const images = [
{ url: "1.jpg" },
{ url: "2.jpg" }
];
But when i use it image slider does not work
const [imagePath, setImagePath] = useState([]);
const fetchData = async () => {
const images = await (await MessageService.getImagesById(location.state.message)).data; //here i get data from db
const imagesPath = images.map(i => ({url: i.url}))
setImagePath(imagesPath);
console.log(imagesPath);//[ {url: "1.jpg"}, {url: "2.jpg"}]
}
};
useEffect(() => {
fetchData();
});