Skip to content

Instantly share code, notes, and snippets.

@yogieputra8
Created August 31, 2016 19:17
Show Gist options
  • Save yogieputra8/3558791ba2ab50bf71e7839eb3677a7e to your computer and use it in GitHub Desktop.
Save yogieputra8/3558791ba2ab50bf71e7839eb3677a7e to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import {
Text,
View,
StyleSheet,
} from 'react-native';
const API_KEY = 'Your-personal-OAuth-token';
const ROOT_URL = 'https://www.eventbriteapi.com/v3/events/search/';
module.exports = React.createClass({
componentDidMount(){
this.searchEvents('hackathon', 'San Fransisco');
},
searchEvents(category, city){
const FETCH_URL = ROOT_URL + '?token=' + API_KEY + '&q=' + category + '&location.address=' + city + '/';
return fetch(FETCH_URL, {
method: 'GET'
})
.then((response) => response.json())
.then((responseJSON) => {
console.log('responseJSON', responseJSON);
})
.catch((error) => {
console.error(error);
});
},
render() {
return (
<View style={styles.container}>
<Text>
Event Expert
</Text>
</View>
)
}
})
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment