So I have an app with an activity. The app checks for Internet connection at the beginning. If there are no Internet connection, it will show a screen with a button to refre
I would suggest putting your API call in it's own function fetchData
within your component. fetchData
can also setState
after a successful fetch which will cause a re-render and show the fresh data. If you want to fetch fresh data on componentDidMount and also on a button click, then create a fetchData
function and call that from within componentDidMount, then for your button just set your onPress prop appropriately onPress={this.fetchData}