react native counter

Solutions on MaxInterview for react native counter by the best coders in the world

showing results for - "react native counter"
Darla
28 Nov 2017
1// React Native Counter Example using Hooks!
2import React, { useState } from 'react';import { View, Text, Button, StyleSheet } from 'react-native';
3const App = () => {  const [count, setCount] = useState(0);
4  return (    <View style={styles.container}>      <Text>You clicked {count} times</Text>      <Button        onPress={() => setCount(count + 1)}        title="Click me!"      />    </View>  );};
5// React Native Styles
6const styles = StyleSheet.create({  container: {    flex: 1,    justifyContent: 'center',    alignItems: 'center'  }});