Skip to content

Sample State

Rudy edited this page Mar 4, 2019 · 6 revisions

Example Redux store shape

{
  entities: {
    restaurants: {
      1: {
        id: 1,
        name: 'Steaks R Us',
        state: 'CA',
        zip: 94511,
        address: '823 Steak Drive',
        city: 'San Francisco',
        website: 'https://www.steaksrus.com',
        averageStars: '4.5',
        priceRange: '3.4',
        lat: '37.775769',
        lng: '-122.434960'
      },
      2: {
        id: 2,
        name: 'Plants R Us',
        state: 'CA',
        zip: '94522',
        address: '123 Plant Drive',
        city: 'San Jose',
        website: 'https://www.plantsforall.com',
        averageStars: '3.5',
        priceRange: '5.0',
        lat: '37.775769',
        lng: '-122.434960'
      }
    },
    styles: {
      1: {
        id: 1,
        style: 'American'
      },
      2: {
        id: 2,
        style: 'Hipster'
      }
    },
    reviews: {
      1: {
        id: 1,
        retaurantId: 1,
        userId: 1,
        numStars: 5,
        content: 'This was the best food I ever had! Will be coming back soon.'
      },
      2: {
        id: 2,
        retaurantId: 1,
        userId: 3,
        numStars: 1,
        content: 'Never again! I was poisoned by the food.'
      }
    },
    restaurantStyles: {
      1: {
        id: 1,
        retaurantId: 1,
        styleId: 1,
      },
      2: {
        id: 2,
        retaurantId: 1,
        styleId: 2,
      },
    }
  },
  errors: {
    login: ['Incorrect username/password combination']
  },
  session: {
    currentUserId: 25
  },
  ui: {
    demo: false
  }
}

Clone this wiki locally