Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import React, { useContext } from 'react';
  2. import { Text, Button, View } from 'react-native';
  3.  
  4. import Context from '../Store/Context';
  5.  
  6. const Counter = () => {
  7. const { counter, increaseCounter, decreaseCounter } = useContext(Context);
  8.  
  9. return (
  10. <View>
  11. <Text style={{ fontSize: 35 }}>Counter:{counter.value}</Text>
  12. <Button onPress={() => increaseCounter()} title={'Increase'} />
  13. <Button
  14. onPress={() => decreaseCounter()}
  15. title={'Decrease'}
  16. color={'black'}
  17. />
  18. </View>
  19. );
  20. };
  21.  
  22. export default Counter;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement