onChangeText() Event in ReactNative

What is event handling?

Event handling is the process by which JavaScript code responds to events. The event handler in this scenario refers to the code itself. The act of resizing a window when a user clicks a button is an example of event handling. JavaScript contributes to a web page's interface being responsive to events.

Event listeners are another name for event handlers but they're a little different. While event handlers carry out the action in response to the event, event listeners watch for any events. 

onPress() Event

    import React,{useState} from 'react';
    import { StatusBar } from 'expo-status-bar';
    import { StyleSheet, Text, View,Button } from 'react-native';
    import { TextInput } from 'react-native';

    export default function App() {

      var [fName, sName] = useState('')

      return (
        <View>
          <Text style={{fontSize:'20px'}}>Your Name ::{fName}</Text>

          <TextInput
            style={styles.textinput}
            placeholder='enter your text'
            onChangeText={(text)=>sName(text)}
          />
           <br />
          <Button title='submit' onPress={()=>sName('')} />
        </View>
      );
    }

    var styles=StyleSheet.create({
      textinput:{
        borderColor:"red",
      }
    })