display account, net ID, and error

This commit is contained in:
Andrea Franz 2020-02-19 17:41:40 +01:00
parent 9f4c668029
commit 438aa2ad7a
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
2 changed files with 19 additions and 1 deletions

View File

@ -1,4 +1,19 @@
import React from 'react';
export default function App(props) {
return `Hello World ${props.account}`;
if (!props.initialized) {
return "initializing...";
}
if (props.error) {
return <>
<p>Error: {props.error}</p>
</>;
}
return <>
<p>Network ID {props.networkID}</p>
<p>Hello {props.account}</p>
</>;
}

View File

@ -2,7 +2,10 @@ import { connect } from 'react-redux';
import App from '../components/App';
const mapStateToProps = state => ({
initialized: state.web3.networkID,
networkID: state.web3.networkID,
account: state.web3.account,
error: state.web3.error,
});
const mapDispatchToProps = dispatch => ({