Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.