i'm making an youtube like page and on the home page i'm trying to make the favorites section and all videos section to re-render after I modify the fav state (a state that contain a array of objects with the data of the videos). The problem is that I'm not being able to make the all videos re-render, only the fav part. I put the skeleton cards on a useEffect and the load videos function and load favorite videos function on another:
useEffect(() => {
setLoading(true)
const timing = setTimeout(() => {
setLoading(false)
}, 1000)
return () => clearTimeout(timing)
}, [])
useEffect(() => {
loadVideos(sort)
favVideos()
}, [fav])
const loadVideos = (sort: string) => {
api.get(`videos?orderBy=${sort}`).then(({ data }) => {
setVideos(data)
})
}
const favVideos = () => {
apiAuth.get('videos/favoritos').then(({ data }) => {
setFav(data)
})
}