Skip to content

Instantly share code, notes, and snippets.

@ashgansh
Last active March 14, 2018 14:54
Show Gist options
  • Save ashgansh/248e36600ad7e8c8aeeba01a885a0c90 to your computer and use it in GitHub Desktop.
Save ashgansh/248e36600ad7e8c8aeeba01a885a0c90 to your computer and use it in GitHub Desktop.
create-react-app with drizzle
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import registerServiceWorker from "./registerServiceWorker";
// A json dump of our abi
import AssetFactory from "./AssetFactory.json"
// A way to provide to set the state of Drizzle to the rest of our app
import { DrizzleProvider } from 'drizzle-react';
const options = {
web3: {
block: false,
fallback: {
type: "ws",
// this needs to point to ganache
url: "ws://127.0.0.1:8545"
}
},
contracts: [AssetFactory],
events: {
AssetFactory: ["NewAsset"]
}
};
ReactDOM.render(
<DrizzleProvider options={options}>
<App />
</DrizzleProvider>,
document.getElementById("root")
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment