Last active
September 10, 2018 15:09
-
-
Save sathinduga/824077ca361d2330b2c66ba4720ac2e7 to your computer and use it in GitHub Desktop.
Main Screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'; | |
import { connect } from 'react-redux'; | |
import { counterAdd, counterSubtract } from '../store/actions/index'; | |
import CounterComponent from '../components/counter'; | |
class MainScreen extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
}; | |
} | |
render() { | |
return ( | |
<View style={styles.mainContainer}> | |
<CounterComponent /> | |
<View style={styles.buttonContainer}> | |
<TouchableOpacity onPress={() => this.props.counterAddFunction()}><Text>INCREASE</Text></TouchableOpacity> | |
<TouchableOpacity onPress={() => this.props.counterSubtractFunction()}><Text>DECREASE</Text></TouchableOpacity> | |
</View> | |
</View> | |
); | |
} | |
} | |
const mapStateToProps = state => { | |
return { | |
}; | |
}; | |
const mapDispatchToProps = dispatch => { | |
return { | |
counterAddFunction: () => dispatch(counterAdd()), | |
counterSubtractFunction: () => dispatch(counterSubtract()), | |
}; | |
}; | |
export default connect(mapStateToProps, mapDispatchToProps)(MainScreen); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment