Skip to content

Instantly share code, notes, and snippets.

View vikrantnegi's full-sized avatar
Focusing

Vikrant Negi vikrantnegi

Focusing
View GitHub Profile
const BookCardPlaceholderComponent = () => (
<Placeholder
Animation={ShineOverlay}
style={{
marginVertical: 6,
marginHorizontal: 15,
borderRadius: 4
}}
Left={props => (
<PlaceholderMedia
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 => {
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 => {
const { items } = responseJson;
const booksList = items.map(book => {
const {
volumeInfo: { title, authors, imageLinks },
id: bookId
{
isDataFetched ? renderX() : renderPlaceholders();
}