Reputation: 14831
I am building a mobile application using ReactNative. My app is interacting with an API. I am trying to mock the API requests using Mirage JS when I am building the app locally following this link, https://miragejs.com/quickstarts/react-native/development/. I basically installed miragejs and copied the code from the link into App.tsx file.
This is my code.
if (window.server) {
server.shutdown()
}
window.server = createServer({
routes() {
this.get("/api/movies", () => {
return {
movies: [
{ id: 1, name: "Inception", year: 2010 },
{ id: 2, name: "Interstellar", year: 2014 },
{ id: 3, name: "Dunkirk", year: 2017 },
],
}
})
},
})
I am getting the following compilation error in the IDE.
How can I fix it?
Upvotes: 0
Views: 562