Created
March 9, 2017 02:33
-
-
Save jungchris/79789f415bf71647efd861f316b016aa to your computer and use it in GitHub Desktop.
Seven Lines of React Native Code to Show a Stock Price Alert
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
// 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