Compiled successfully but received Uncaught promise in console, I did read in some other post that there maybe change to Metamask in November 2018:
Uncaught (in promise) Error: Provider not set or invalid
at Object.InvalidProvider (errors.js:38)
WEB3.JS
import Web3 from 'web3';
const web3 = new Web3(window.web3.currentProivder);
export default web3;
APP.JS
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import web3 from './web3';
class App extends Component {
render() {
console.log(web3.version);
web3.eth.getAccounts().then(console.log);
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
}
export default App;
INDEX.JS
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
serviceWorker.unregister();
Lecture 90
Compiled successfully but received Uncaught promise in console, I did read in some other post that there maybe change to Metamask in November 2018:
WEB3.JS
APP.JS
INDEX.JS