Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6290

How can we declare and use class in react-native functional component without extending it with React.Component?

$
0
0

The question is simple. I just want to create a class in function component. Declare the variable inside that class and use it in function component.

For Example here is my app.js.

const App = () => {   const [count, setCount] = useState(0);   const increaseCount = () => {     setCount(count+1)   }   return (<View><Pressable onPress={() => {increaseCount()}} ><Text>Increase</Text></Pressable><Text>{count}</Text></View>   )} 

I just want the same functionality with class.I repeat with CLASS not CLASS COMPONENT.

Please anyone help me with this!!


Viewing all articles
Browse latest Browse all 6290

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>