Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught promise #12

Open
bfbuckler opened this issue Nov 13, 2018 · 0 comments
Open

Uncaught promise #12

bfbuckler opened this issue Nov 13, 2018 · 0 comments

Comments

@bfbuckler
Copy link

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:

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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant