AxiosError Network Error to fetching jsonServer data

33 Views Asked by At

I have created a json-server and it successfully hosted as mentioned attached file. I can show the data from web-browser but When I fetch the data by get methods in react-native, it occurred an error like [AxiosError: Network Error].

Fetch data by get methods in React-Native:

  const getVideoDetails = () => {
    axios
      .get('http://192.168.0.103:3000/videos')
      .then(res => {
        console.log(res.data);
      })
      .catch(error => {
        console.log(error);
      });
  };

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

Starting JSON_SERVER

0

There are 0 best solutions below