Skip to content

React Native

Wei edited this page May 13, 2019 · 1 revision

Expo CLI quickstart

npm install -g expo-cli
expo init AwesomeProject
cd AwesomeProject
npm start # you can also use: expo start

Learn the Basics

import React, { Component } from 'react';
import { Text, View } from 'react-native';

export default class HelloWorldApp extends Component {
  render() {
    return (
      <View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
        <Text>Hello, world!</Text>
      </View>
    );
  }
}

The other unusual thing in this code example is Hello world!. This is JSX - a syntax for embedding XML within JavaScript. <Text> is a built-in component that just displays some text and View is like the <div> or <span>.

Clone this wiki locally