import React, { Component } from 'react' import { connect } from 'react-redux' import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom' import MediaQuery from 'react-responsive' import { Web3Connect, startWatching, initialize } from '../ducks/web3connect' import { setAddresses } from '../ducks/addresses' import Header from '../components/Header' import Swap from './Swap' import Send from './Send' import Pool from './Pool' import './App.scss' class App extends Component { componentWillMount() { const { initialize, startWatching } = this.props initialize().then(startWatching) } componentWillUpdate() { const { web3, setAddresses } = this.props if (this.hasSetNetworkId || !web3 || !web3.eth || !web3.eth.net || !web3.eth.net.getId) { return } web3.eth.net.getId((err, networkId) => { if (!err && !this.hasSetNetworkId) { setAddresses(networkId) this.hasSetNetworkId = true } }) } render() { if (!this.props.initialized) { return } return (