React Native class component


class component: class component access react lifecycle methods and render and state props functionality.

app name : test

component name: App.js

-----------------------------------------------------------------------------------------------------------------------

/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/

import React, { Component } from 'react'
import { View, Text, Button, } from 'react-native';
class App extends Component {
render()
{
function hello(){
alert("Welcome class component ReactNative King")
}
return(
<View>
<Text>Class Component </Text>
<Button title="Click Me " onPress={hello}/>
</View>

)
}
}


export default App;



Comments

Popular posts from this blog

React Native FlatList