pass parameters to a React-query useQuery

 https://stackoverflow.com/questions/68105012/what-is-the-correct-way-to-pass-parameters-to-a-react-query-usequery-method-that

export const getProduct = async (prodId) => {
    const { data } = await axios.get(`/api/v1/products/${prodId}`)
    return data
}
const { data } = useQuery(['product', prodId], () => getProduct(prodId))

Không có nhận xét nào:

xóa toàn bộ commit

  Cách chuẩn & đơn giản nhất (Khuyến nghị) Mục tiêu Xóa toàn bộ commit history Giữ nguyên code hiện tại main chỉ còn 1 commit...