Created
February 3, 2019 06:18
-
-
Save galihlprakoso/5a2b2ec967b4d1a1a4a1fe5d2a0a2384 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { StyleSheet, Text, View } from 'react-native'; | |
//Custom Component bernama Pahlawaan | |
class Pahlawan extends React.Component { | |
render(){ | |
return ( | |
<View> | |
{/* Menampilkan props 'nama' yang dikirimkan oleh Parentnya. */} | |
<Text>{this.props.nama}</Text> | |
</View> | |
); | |
} | |
} | |
export default class App extends React.Component { | |
render() { | |
return ( | |
<View style={styles.container}> | |
{/* Menampilkan Component Pahlawan dengan mengirimkan props 'nama' */} | |
<Pahlawan nama="Soedirman" /> | |
<Pahlawan nama="Hasyim Asyari" /> | |
<Pahlawan nama="Pangeran Diponegoro" /> | |
<Pahlawan nama="Ki Hadjar Dewantara" /> | |
<Pahlawan nama="Bung Tomo" /> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
backgroundColor: '#fff', | |
alignItems: 'center', | |
justifyContent: 'center', | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment