import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Header } from 'semantic-ui-react'; import { connect } from 'react-redux'; import UsernameFormContainer from './UsernameFormContainer'; class SignUpContainer extends Component { componentDidUpdate(prevProps) { const { user, history } = this.props; if (user.hasSignedUp && !prevProps.user.hasSignedUp) history.push('/'); } render() { const { user } = this.props; return ( user.hasSignedUp ? (
There is already an account for this addresss.
If you want to create another account please change your address.
) : (

Sign Up

Account address: {' '} {user.address}

) ); } } SignUpContainer.propTypes = { user: PropTypes.object.isRequired, history: PropTypes.object.isRequired }; const mapStateToProps = state => ({ user: state.user }); export default connect(mapStateToProps)(SignUpContainer);