Skip to content

Instantly share code, notes, and snippets.

@SathinduGA
Last active September 10, 2018 11:47
Show Gist options
  • Save SathinduGA/88d9053660112a1c7cc3df3dbeb22921 to your computer and use it in GitHub Desktop.
Save SathinduGA/88d9053660112a1c7cc3df3dbeb22921 to your computer and use it in GitHub Desktop.
Counter Component
import React, { Component } from "react";
import { View, Text, StyleSheet } from "react-native";
import { connect } from "react-redux";
class CounterComponent extends Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
return (
<View>
<Text style={styles.text}> {this.props.counterValue} </Text>
</View>
);
}
}
const mapStateToProps = state => {
return {
counterValue: state.counter.count
};
};
const mapDispatchToProps = dispatch => {
return {
};
};
export default connect( mapStateToProps, mapDispatchToProps) (CounterComponent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment