Skip to content

Instantly share code, notes, and snippets.

@jungchris
Created March 9, 2017 02:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jungchris/79789f415bf71647efd861f316b016aa to your computer and use it in GitHub Desktop.
Save jungchris/79789f415bf71647efd861f316b016aa to your computer and use it in GitHub Desktop.
Seven Lines of React Native Code to Show a Stock Price Alert
// Credit to: https://blog.expo.io/react-native-meets-async-functions-3e6f81111173#.7dvhnohnu
async function showAppleStockPriceAsync() {
let url = 'http://dev.markitondemand.com/Api/v2/Quote/json?symbol=AAPL'
let response = await fetch(url)
let body = await response.json()
let { AlertIOS } = require('react-native')
AlertIOS.alert(body.Symbol, '$' + body.LastPrice)
}
showAppleStockPriceAsync()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment