This file contains hidden or 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
const BookCardPlaceholderComponent = () => ( | |
<Placeholder | |
Animation={ShineOverlay} | |
style={{ | |
marginVertical: 6, | |
marginHorizontal: 15, | |
borderRadius: 4 | |
}} | |
Left={props => ( | |
<PlaceholderMedia |
This file contains hidden or 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
export default function App() { | |
const [books, setBooks] = useState([...new Array(10).fill({})]); | |
const [isDataFetched, setDataFetched] = useState(false); | |
useEffect(() => { | |
fetch( | |
"https://www.googleapis.com/books/v1/volumes/?maxResults=30&q=danbrown" | |
) | |
.then(response => response.json()) | |
.then(responseJson => { |
This file contains hidden or 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
const [books, setBooks] = useState([...new Array(10).fill({})]); | |
const [isDataFetched, setDataFetched] = useState(false); |
This file contains hidden or 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
useEffect(() => { | |
fetch("https://www.googleapis.com/books/v1/volumes/?maxResults=30&q=danbrown") | |
.then(response => response.json()) | |
.then(responseJson => { | |
const { items } = responseJson; | |
const booksList = items.map(book => { | |
const { | |
volumeInfo: { title, authors, imageLinks }, | |
id: bookId |
This file contains hidden or 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
{ | |
isDataFetched ? renderX() : renderPlaceholders(); | |
} |
OlderNewer