そろそろReact Nativeに移行する②

App.js(親コンポーネント

import { View, Text, Button } from 'react-native';
import BtnTxt from './BtnTxt'

const App = ()=>{
  return(
    <View style={{flex:1,justifyContent:'center'}}>
      <BtnTxt name ="Hello"></BtnTxt>
    </View>
  )
}

export default App;

 

BtnTxt.js(子コンポーネント

import {Button,View,Text} from 'react-native';
const BtnTxt = (props)=>{
   
    return(
        <View>
              <Text>{props.name}</Text>
              <Button title="PUSH"></Button>
        </View>
    )
  }

export default BtnTxt;

React.jsにおけるindex.jsのようなものは、React Nativeでは不要です。