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
import React, {useEffect, useState} from 'react'; | |
import axios from "axios"; | |
import UserComponent from "./UserComponent"; | |
const USER_SERVICE_URL = 'https://jsonplaceholder.typicode.com/users'; | |
function UserFetchUsingHook() { | |
//example of fetching data | |
const [data, setData] = useState({users: [], isFetching: 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<title>Starter Template</title> | |
<meta name="description" content=""> |
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 function PromiseWithTimeout(ms, promise) { | |
// Create a promise that rejects in x milliseconds | |
let timeout = new Promise((resolve, reject) => { | |
let id = setTimeout(() => { | |
reject('timeout'); | |
}, ms) | |
}) | |
// Returns a race between timeout and the passed in promise |
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
<!DOCTYPE html> | |
<style> | |
video { | |
-webkit-transform: scaleX(2); | |
-moz-transform: scaleX(2); | |
} | |
</style> | |
<video src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.ogv"></video> |