'React Native and Sanity Fetch Request Problems/Mistake?

I am trying to fetch data from a Sanity Database HTML link but eveything i try it does not work...

I am trying not to use the sanity client but just the link itself (Http:....)

import React, { useEffect, useState } from 'react';
import { ActivityIndicator, FlatList, Text, View } from 'react-native';

export default App = () => {
  const [isLoading, setLoading] = useState(true);
  const [data, setData] = useState([]);

  const getMovies = async () => {
     try {
      const response = await 
      fetch('https://6ws4ci2k.api.sanity.io/v2021-10-21/data/query/production query=*%5B_type%20%3D%3D%20%22post%22%5D%7B%0A%20%20title%2C%0A%20%20content%2C%0A%20%20emojiType%0A%7D%0A%0A');
      const json = await response.json();
      setData(json.result);
    } catch (error) {
      console.error(error);
    } finally {
      setLoading(false);
    }
  }

  useEffect(() => {
    getMovies();
  }, []);


console.log({data})

  return (
    <View style={{ flex: 1, padding: 24 }}>
      {isLoading ? <ActivityIndicator/> : (
        <FlatList
          data={data}
          keyExtractor={({ id }, index) => id}
          renderItem={({ item }) => (
            <Text>{item.title}, {item.releaseYear}</Text>
          )}
        />
      )}
    </View>
  );
};

The link of the HTML Request: https://6ws4ci2k.api.sanity.io/v2021-10-21/data/query/production?query=*%5B_type%20%3D%3D%20%22post%22%5D%7B%0A%20%20title%2C%0A%20%20content%2C%0A%20%20emojiType%0A%7D%0A%0A

Expo Testing Project:https://snack.expo.dev/xpnoDpRrH



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source