State in React Native Example
App.js:-
import React, { useState } from 'react';
import { Text, Button, View } from 'react-native';
const App = () => {
const [name, setName] = useState("Krishan");
function testName() {
setName("Dev")
}
return (
<View>
<Text style={{ fontSize: 50 }}>{name}</Text>
<Button title='Press Me' onPress={testName}></Button>
</View>
);
};
export default App;
Comments
Post a Comment