I need that when adding new data, the slider does not start spinning again, but continues adding new pages for new data, thanks in advance
useEffect(() => {
const fetchData = async () => {
try {
const response = await fetch('http://localhost:8000/api/getData', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
})
const dataJson = await response.json()
const groupKZ = []
const groupRU = []
const kz = dataJson.map(item => {
const {ret_ru_status, ...newItem} = item
return newItem
})
groupKZ.push(kz)
const ru = dataJson.map(item => {
const {ret_status_kz, ...newItem} = item
return newItem
})
groupRU.push(ru)
const all = [...groupKZ[0], ...groupRU[0]]
setDataKZ(all)
} catch (error) {
console.error(error)
}
}
fetchData()
}, [])
const Auto = withAutoplay(AwesomeSlider)
return (
<Auto play={true} cancelOnInteraction={false} interval={2000} bullets={false} buttons={false} infinite>
{data.map((val, idx) => {
return <div key={idx}>
text
</div>
})}
</Auto>
)
that is, I will have a function called every minute