I can't get this combo to work. I think it's specifically due to having TypeScript in the mix? My syntax is as seen here but I get runtime issues. There are no compile errors but, when the func is encountered, I get:
this.foo is not a function
export default class App extends Component<Props> {
render() {
return (
<Button title="A Button" onPress={this.buttonPressed} />
);
}
buttonPressed() {
this.foo().then(movies => {
console.log(movies);
});
}
async foo() {
try {
let response = await fetch('https://facebook.github.io/react-native/movies.json');
let responseJson = await response.json();
return responseJson.movies;
} catch (error) {
console.error(error);
}
}
}