Decentralizing your data

To fully implement the smart contract, we have to take a look at each section of the website to update its contents with data from the smart contract. Let's go from top-left to bottom-right. In that order, the first thing we have to decentralize is the top hashtags sections, using the getTopHashtags() function:

async setup() {    window.web3js = new Web3Js(ethereum)    try {        await ethereum.enable();    } catch (error) {        alert('You must approve this dApp to interact with it, reload it to approve it')    }    const user = (await web3js.eth.getAccounts())[0]    window.contract = new web3js.eth.Contract(ABI.abi, ABI.networks['3'].address, {        from: user    })    await this.setState({contract, user})}

You'll also have to update your render() function ...

Get Mastering Ethereum now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.