Created
July 4, 2019 11:38
-
-
Save perborgen/678dc4baf8c22ca38651420c5644eb09 to your computer and use it in GitHub Desktop.
Amazing recepies
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
<html> | |
<head> | |
<script src="https://unpkg.com/react@16/umd/react.development.js"></script> | |
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> | |
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script> | |
<style> | |
/* | |
PASTE CSS HERE (Optional) | |
*/ | |
</style> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script type="text/babel"> | |
const getData = async (search) => { | |
const proxyurl = "https://cors-anywhere.herokuapp.com/"; | |
const url = `http://www.recipepuppy.com/api/?q=${search}`; | |
const response = await fetch(proxyurl + url).catch(() => | |
console.log("Can’t access " + url + " response. Blocked by browser?") | |
); | |
const json = await response.json(); | |
return json.results; | |
}; | |
/* | |
ADD REACT CODE HERE | |
*/ | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment