Distinguish between Javascript and HTML

I'm currently trying to understand some JavaScript code in an App.js file for my react native app. I want to know if the code of<AppLoading/> <View> components are considered HTML code or JavaScript code?

export class App extends React.Component {
  state = {
    isLoadingComplete: false,
  };

  render() {
    if (!this.state.isLoadingComplete && !this.props.skipLoadingScreen) {
      return (
        <AppLoading
          startAsync={this._loadResourcesAsync}
          onError={this._handleLoadingError}
          onFinish={this._handleFinishLoading}
        />
      );
    } else {
      return (
        <View style={styles.container}>
          {Platform.OS === 'ios' && <StatusBar barStyle="default" />}
          <AppNavigator />
        <View/>
      );
    }
  }

1 answer

  • answered 2019-05-15 03:21 Alex

    It's a syntax extension to Javascript called JSX. You can read about it here.

    You can think about it more or less like regular HTML, but with a few important syntax differences (such as replacing class attributes with className, requiring a parent element if there's multiple siblings, etc.) and the ability to inject JS expressions inside curly brackets.