I am new to React Native. I want to create a simple counter button. I could not use "this", it gives error ('this' implicitly has type 'any' because it does not have a type annotation.). You can see my TabTwoScreen.tsx TypeScript code below. I searched other questions but i could not find what to do. Why this is not working and how can I correct it. Waiting for helps. Thanks a lot.
import * as React from 'react';import { StyleSheet, Button, Alert } from 'react-native';import EditScreenInfo from '../components/EditScreenInfo';import { Text, View } from '../components/Themed';export default function TabTwoScreen() { const state={ counter: 0, } const but1 = () => { this.setState({counter : this.state.counter + 1}); }; return (<View style={styles.container}><Text style={styles.title}>Counter:{state.counter}</Text><Button title="Increment" onPress={but1} accessibilityLabel="increment" color="blue" /></View> );}const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', }, title: { fontSize: 20, fontWeight: 'bold', }, separator: { marginVertical: 30, height: 1, width: '80%', },});