React Native | Class Component
App.js:
import React, { Component } from 'react';
import { Button, Text, TextInput, View } from 'react-native';
import Student from './components/student';
class App extends Component {
fuit = () => {
console.warn("Apple");
}
render() {
return (
<View>
<Text style={{ fontSize: 30, backgroundColor: 'blue', color: 'white', marginBottom:10 }}>Class Component</Text>
<TextInput style={{ borderColor: 'black', borderWidth: 5, marginBottom:10 }} placeholder='Enter text' />
<Button style={{marginBottom:10}} title='Press Me' onPress={this.fuit}></Button>
<Student/>
</View>
)
}
}
export default App;
------------------------
Student.js
import React, { Component } from 'react';
import { Button, Text, TextInput, View } from 'react-native';
class Student extends Component {
render() {
return (
<View>
<Text style={{ fontSize: 30, backgroundColor: 'black', color: 'white', marginTop:10 }}>Student Component</Text>
</View>
)
}
}
export default Student;
Comments
Post a Comment