coopermaruyama/react-web3

web3@1.0 - 'cb is not a function'

Closed this issue · 6 comments

Used to work perfectly, but since upgrading to web3.js 1.0, I get a repeating error (only when using react-web3).

It still works, but I can't get rid of the error.

screen shot 2017-11-29 at 11 52 00 pm

Here's the code:

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import { Web3Provider } from 'react-web3';

ReactDOM.render(
   <Web3Provider>
      <App />, document.getElementById('root')
   </Web3Provider>
);

I have the same error with the same code. But I fixed the issue by removing references to the web3 libraries from other parts of my of application. I now simply check for window.web3 and use this object rather than importing one.

Good to hear you found a workaround. I believe thats less safe, since the web3 object can be different in future versions of metaMask. I stopped using this library for now, and made my own splash screen using the following code:

screen shot 2017-12-19 at 10 55 55 pm

@haydenadams, thanks for this. I'm going to look into this now. My assumption is web3 1.0 has a different API incompatible with this react-web3. Going to see if I can make it work with both.

@haydenadams I have a WIP which has 1 failing test left on web3-v1 branch. Will release soon.

closing this for now in favor of #16