how to use rest api with vision api in react

JavaScript
// let image = base64 string of the image

let body = JSON.stringify({
    requests: [
        {
            image: {
                content: image
            },
            features: [
                { type: "TEXT_DETECTION", maxResults: "5"},
            ]
        }
    ]
});let response = await fetch("https://vision.googleapis.com/v1/images:annotate?key=" + GOOGLE_API_KEY, {
        method: "post",
        body: body,
        headers: {
            Accept: "application/json",
            "Content-Type": "application/json"
        },
    }
);
Source

Also in JavaScript: