duocmmo / edu-comments

Quản lý các bình luận trên edu.duthanhduoc.com
https://edu.duthanhduoc.com/
0 stars 0 forks source link

https://edu.duthanhduoc.com/learn/ReactJs-Super?lessonId=127 #32

Open utterances-bot opened 1 month ago

utterances-bot commented 1 month ago

Khu vực học tập | Được Edu

Được chỉ cung cấp các khóa học lập trình online chất lượng, nói không với khóa lởm!

https://edu.duthanhduoc.com/learn/ReactJs-Super?lessonId=127

vinh4979 commented 1 month ago

useQuery v5 không dùng được onSuccess nữa

duthanhduoc commented 1 month ago

useQuery v5 không dùng được onSuccess nữa

Chúng ta có thể xử lý onSuccess như thế này nhé

export const useGetCourseInfo = ({ url }: { url: string }) => {
  return useQuery({
    queryKey: ['student', 'courseInfo', url],
    queryFn: () => studentCourseApi.getCourseInfo(url).then(res => {
      // Xử lý onSuccess tại đây nhé
      // ....
      return res
    })
  })
}
vinh4979 commented 1 month ago

Em đang gặp vấn đề ở lấy thông tin itemStudent theo id. Em test trên server theo đường dẫn /students/1 thì api trả về arr rỗng

duthanhduoc commented 1 month ago

Em đang gặp vấn đề ở lấy thông tin itemStudent theo id. Em test trên server theo đường dẫn /students/1 thì api trả về arr rỗng

Không code không đoán được em bị cái gì, em có thể đăng bài lên group react.js trên facebook kèm link github nhé. Nhớ mô tả lỗi và bài em gặp phải