Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active August 6, 2021 11:27
Show Gist options
  • Save percybolmer/f581618d900c155d66ce756cdf8f1b99 to your computer and use it in GitHub Desktop.
Save percybolmer/f581618d900c155d66ce756cdf8f1b99 to your computer and use it in GitHub Desktop.
import logo from './logo.svg';
import './App.css';
// These imports are important
import React, { useState, useEffect } from 'react';
import Web3 from 'web3-eth'
function App() {
// this will trigger whenever the App function is called, which index.js runs at startup
useEffect(() => {
// Here we check if there is web3 support
if (typeof web3 !== 'undefined') {
}else {
// The browser has no web3
// Suggest the user to install a web3 compatible browser plugin
throw new Error("No web3 support, redirect user to a download page or something :) ");
}
});
return (
<div className="App">
<header className="App-header">
<p> Welcome to your DAPP application</p>
</header>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment