Fetch data from local Json server in React-Native

My Local Json Server data is something like this: Json

I used it in server:

import axios from 'axios';
const Server = axios.create({
  baseURL: 'http://localhost:3000/office',
  timeout: 5000,
  headers: {'accept': 'application/json'}
export default Server;

But I'm unable to fetch it, I need help in fetching it from local json server.

export function fetchJobs(props) {
  return function(dispatch){
    dispatch({type: JobsTypes.FETCH_OFFICE});
    .then((response) => {
      dispatch({type: JobsTypes.FETCH_OFFICE_SUCCESSFUL,payload:response.data });
    .catch((err) => {

1 answer

  • answered 2018-04-17 04:14 flaky

    I assume you're using Android Virtual Device?

    Localhost is going to be: So in your case you have to use: ''

    Let me know if this works for you.