-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24cb06f
commit c09b588
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { AsyncStorage } from "react-native"; | ||
|
||
const dummyData = { | ||
React: { | ||
title: "React", | ||
questions: [ | ||
{ | ||
question: "What is React?", | ||
answer: "A library for managing user interfaces" | ||
}, | ||
{ | ||
question: "Where do you make Ajax requests in React?", | ||
answer: "The componentDidMount lifecycle event" | ||
} | ||
] | ||
}, | ||
JavaScript: { | ||
title: "JavaScript", | ||
questions: [ | ||
{ | ||
question: "What is a closure?", | ||
answer: | ||
"The combination of a function and the lexical environment within which that function was declared." | ||
} | ||
] | ||
} | ||
}; | ||
|
||
export const STORAGE_KEY = "UdaciCard:StorageKey"; | ||
|
||
function setDummyData() { | ||
AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(dummyData)); | ||
return dummyData; | ||
} | ||
|
||
export function fetchData(results) { | ||
return results === null ? setDummyData() : JSON.parse(results); | ||
} |