React Native Tutorial

Let’s begin

React Native

所有的一切都是 Component,

第一行就先當做是固定import的,
第二行就是需要引入的view物件(官方做好的components)。

1
2
3
4

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

傳值:

需要可以被別的class使用,需要關鍵字export
props:屬性 => 不需宣告或是init,可直接傳入後使用,傳入後無法變更

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

export default class Layout extends React.Component {
// constructor() {
// super();

// }

render() {
return(
<Text>It's {this.props.name}</Text>
);
}

}

Title:React Native Tutorial

Author:Dean Kai Chang

Post Time:2018/07/26 - 00:07

Last update:2018/08/01 - 11:08

Original Link:https://deankai.github.io/2018/07/26/react_native_tutorial1/

許可協議: 署名-非商業性使用-禁止演譯 4.0 國際 轉載請保留原文連結和作者。