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:

api feed with published=false?

  Câu trả lời ngắn gọn là: CÓ . Trên thực tế, đây chính là cách chuẩn nhất để tạo các bài viết chưa hiển thị công khai (bao gồm Bản nháp, B...