React Native / Expo pass url to WebBrowser


Looking at the Expo WebBrowser example at:

import React, { Component } from 'react';
import { Button, Text, View, StyleSheet } from 'react-native';
import { Constants, WebBrowser } from 'expo';

export default class App extends Component {
  state = {
    result: null,

  render() {
    return (
      <View style={styles.container}>
          title="Open WebBrowser"
        <Text>{this.state.result && JSON.stringify(this.state.result)}</Text>

  _handlePressButtonAsync = async () => {
    let result = await WebBrowser.openBrowserAsync('');
    this.setState({ result });

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    paddingTop: Constants.statusBarHeight,
    backgroundColor: '#ecf0f1',

How could a best practice example be to have multiple buttons open different urls?
Should I give each button an externalurl property and pass it to the _handlePressButtonAsync function?

I tried to do it that way with openBrowserAsync(this.props.externalurl) and gave the button externalurl="" but seems like it’s undefined.

Any tips, thanks!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.