Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [react]

React (also known as React.js or ReactJS) is a JavaScript library for building user interfaces. It uses a declarative paradigm and aims to be both efficient and flexible.

Filter by
Sorted by
Tagged with
-1
votes
0answers
15 views

Working with CEth and web3js in Compound Finace [on hold]

What could be the best way to initiate a borrow activity while using web3js interacting with Compound Finance: const cToken = CEther.at(0x3FDB...); await cToken.methods.borrow(50).send({from: ...
0
votes
1answer
20 views

How do I fix it? To be able to send eth from smartcontract to the address

Frontend class App extends React.Component { state = { address: '', } async componentDidMount() { await window.ethereum.enable() this.w3 = new Web3(window.ethereum) const ...
0
votes
1answer
10 views

How can I add new contracts generated from a factory to my drizzle-react app?

I have a Factory contract which creates new contracts. How do I get the new contract into my drizzle-react web app? I am using to send the transaction to create a new contract but I don't know how ...
0
votes
0answers
12 views

How do I get the value from the event to be displayed on the webpage? [duplicate]

I can connect and console.log the event. But can't bring the value to display on the webpage. I don't know what to do. Front-end import React from 'react'; import logo from './logo.svg'; import './...
0
votes
0answers
28 views

What do I have to do to call this events to be display on the web page?

How do I call showLottery to display on my webpage? Front-End class App extends React.Component { state = { address: '', lottery: '', events: '', } async componentDidMount() { ...
0
votes
0answers
15 views

Is there any example of a drizzle-react dapp implementation that uses render props?

Render props were added after React 16.3 and the github readme for drizzle-react suggests to use them. The problem for is that there is no updated documentation (other then the small example in the ...
0
votes
0answers
24 views

getPastEvents undefined(please help)

I had asked this question before. I looked carefully at the exchange section, which I advised, and I think there is no problem with the exchange section. At least in my opinion there is no problem and ...
1
vote
1answer
21 views

Creating a contract instance

Is it generally better to define a contract instance once, then pass it through your components like... class Parent extends React.Component{ constructor(props){ super(props); ...
0
votes
1answer
29 views

TypeError: market.FileViewed is not a function while trying to watch event

I want to watch for fileViewed event and it throws TypeError: market.FileViewed is not a function in marketplace.FileViewed{ ^ My solidity contract: pragma solidity ^0.5.0; contract ...
0
votes
0answers
18 views

“drizzle-react-components” import Error for “LoadingContainer”

I am trying to import import { LoadingContainer } from 'drizzle-react-components' Which I succfully installed with npm install drizzle-react-components@1.3.0 It was installed inside the directory ...
0
votes
0answers
14 views

How can I specify a date picker in one of the fields in my ContractForm React component?

I'm using the ContractForm React component available in the drizzle-react-component library. It's super nice and easy to setup and use, but I am dealing with a date in one of the fields (which is ...
1
vote
3answers
116 views

Why web3.eth.getAccounts().then(console.log) return empty array?

It's really weird that I got empty array after I tried to web3.eth.getAccounts().then(console.log);and I also got a warning which is ./node_modules/web3-eth-accounts/src/scrypt.js Critical dependency: ...
0
votes
1answer
34 views

Contract with multiple signing keys

How things work I have a Factory contract, FContract. FContract can be called by a user as many times as they want, creating instances of, let's call it, contractA. Thus, they're able to own as many ...
0
votes
1answer
64 views

Web3-core-helpers error: Uncaught (in promise) Error: Provided address “undefined” is invalid,

When I launch the app with with react.. this error occur when my exchange contract is loaded.. Here is the code i wrote to talk to the blockchain: export const loadBalances = async (dispatch, web3, ...
0
votes
1answer
183 views

gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1

I used the command truffle unbox react to build a dapp. It is just the initial step of my dapp development. However, it sucks. It continually pops up gyp ERR! build error gyp ERR! stack Error: `C:\...
0
votes
0answers
23 views

Error: IPFSInbox has not been deployed to detected network

It's my first time writing smart contract in solidity and using IPFS to develop my dapp. I don't know how to solve it and why it pops up this errorNo web3 instance injected, using Local web3. Error: ...
0
votes
0answers
31 views

Payable function not working properly

Hi everyone hope I will be clear enough with the explanation because I couldn't find a proper solution. I am just trying to checkout an item with my buy function but it seems like I am stuck.Here is ...
1
vote
1answer
64 views

Both web3.eth.accounts.create() and web3.eth.personal.newAccount() not working

I'm making a dApp on reactjs. I wanted to create a new account and have done it trying 2 methods this.web3.eth.personal.newAccount() this.web3.eth.accounts.create() I have attached the code below(...
0
votes
1answer
75 views

getAccounts in web3 js undefined

I am working on dapp with web3js 1.0.0.37-beta with reactjs. I got blank in web3.eth.getAccounts. Following is my code App.js import React, {Component} from 'react'; import '../node_modules/...
0
votes
1answer
32 views

Code:const web3 = new Web3(window.web3.currentProvider) Error: window.web3 is undefined

I am going to connect my contract with the website.However,there was something wrong with the web3? I'm not sure. import Web3 from "web3"; const web3 = new Web3(window.web3.currentProvider); const ...
0
votes
1answer
90 views

Event emits multiple times on a solidity function call

I need have a problem, when I execute a solidity function, event emits multiple times, but when I refresh page then it works normally and only past events get called. Here is my code: ...
0
votes
0answers
27 views

How to use the ipfs.add() function?

Here is a function that I have written to add a file on clicking a button, which calls the function 'onSubmit' onSubmit = async (event) => { event.preventDefault() await ipfs.add(this.state....
0
votes
1answer
85 views

Why Web3 event callback fires multiple times same as the number of the solidity smart contract emitted that event in past?

I am just learning, solidity with react and web3 and I am facing the issue on page load the callback event of web3 called multiple time the number is same as I called a solidity function and that emit ...
2
votes
1answer
61 views

Uncaught (in promise) Error while opening and doing transaction on private ethereum blockchain using web3 and go-ethereum

I am trying to integrate a react app with go-ethereum using web3js. an event Onsubmit will do the following: 1. Create an account. 2. Open the account. 3. Approve a smart contract with the created ...
0
votes
0answers
32 views

Error using drizzle and react

My contract Storage.sol - pragma solidity ^0.5.0; contract Storage { string public data; function getData() view external returns(string memory) { return data; } function setData(...
0
votes
0answers
13 views

Getting error when importing, no error when using code in single file: Failed to execute 'postMessage' on 'Window'

I am trying to access the web3 object injected into my browser by Metamask. I am using custom rpc (). I can see my accounts and correct balances in Metamask. I have the following code: //web3.js ...
0
votes
0answers
38 views

uncaught error:invalid address

Uncaught (in promise) Error: invalid address at inputAddressFormatter (formatters.js:271) at inputTransactionFormatter (formatters.js:97) at method.js:89 at Array.map (<anonymous>...
0
votes
1answer
48 views

How to deploy a smart contract to actual ethereum network instead of Truffle or Ganache?

I am building a react application using web3 to interface with Ethereum. At a bare minimum, it needs to create a contract, deploy said contract, store a value (i.e. a string: "test"), then later ...
0
votes
1answer
28 views

How to print “string” from Solidity in React?

My smart contract function is : function sNName(uint z)public view returns(string memory) { return abc[xyz[z].name]; } Where abc represents a mapping (bytes32 => string) In my .js file, I ...
0
votes
3answers
99 views

How to call a smart contract function in a DAPP?

I am trying to make a DAPP. I followed this link - https://medium.com/@takleakshar/how-to-build-a-decentralized-full-stack-app-in-ethereum-and-react-42e63d45a208 This is how my 'Setup.js' looks. ...
0
votes
0answers
41 views

How to Access Value of Drizzle ContractData Method

I would like to access the value of a Drizzle ContractData method: this outputs: 1000000000: <ContractData contract={name} method="getValue" /> Now, ...
1
vote
0answers
105 views

How to use web3-react with truffle Dapp? any sample code / tutorial?

I am new to react and finding issues with the front-end of the Dapp application. Especially in web3 version > web3 1.0.0 I just heard about the web3-react and I think it will be a lot easier. I ...
1
vote
0answers
26 views

How to do loop all the metamask Accounts loop and display data from that address in React frontend + Dapp App JS [duplicate]

I want to Display data stored on the Ropsten Network in more then 2 metamask accounts. I want to display the result on the Home page in the table form. For that I need to loop through each ...
0
votes
0answers
53 views

How to get the value from the frontend form and save value to the blockchain using +web3 1.0.0-beta.37 + reactjs

I am writing my first Dapp and want to save the value of the form to the blockchain. I am Using React and web3 js 1.0.0-beta.37 on the frontend. Also I am new to react. Following is my App.js ...
0
votes
0answers
199 views

Can't resolve 'react' after installing additional dependencies to truffle react box

I am using a truffle box react - after truffle unbox react everything works fine Later however, after yarn add @material-ui/core I get an error: Can't resolve 'react' The same happens after ...
0
votes
0answers
12 views

How to console.log the value in the React js for the Dapp + truffle project

I am beginner with the ReactJS and Dapp. In my js page I want to get the value after doing some operation on the input value and want to dispay that result. I got the Nan in the front-end screen. ...
1
vote
1answer
81 views

No web3 instance injected following the dApp University Tutorials

I've been following Dapp University's videos on how to make IPFS uploads with Euthereum Smart contracts, and after I manage to 'npm run start' in the command line it opens up the HTML, but it always ...
1
vote
1answer
104 views

truffle unbox react - front end is unable to read / set state of the contract

I am experiencing problems with the Truffle React boilerplate code that the front end is unable to read / set state of the contract. Here are the details: I unboxed the React boilerplate using ...
2
votes
2answers
104 views

Metamask injects one account in web3, but calls contracts using another account

Building a React app, MetaMask injects web3, I get accounts[0] from getAccounts(), then pass it to my contract functions together with other parameters. I want my modifiers to lock incoming function ...
0
votes
1answer
34 views

Async getAccounts doesn't see my account

first time using MetaMask web3 Async getAccounts does not return my Eth account which I see in MetaMask. My fiddle https://jsfiddle.net/ysz11/qcv78h9z/1/ <!DOCTYPE html> <html> <...
0
votes
0answers
20 views

Web3NotFound Page rendering every time the drizzle-react DApp is refreshed

I'm trying to build a drizzle-react DApp. I want to implement a page called Web3NotFound.js which gets rendered when drizzle fails to find any web3 injected from MetaMask or Trust wallet browser. ...
0
votes
1answer
28 views

How to show the time when the blockchain contract called? [duplicate]

I want to show the time when blockchain contract called. I am currently saving the time in the blockchain using a method like this function userCheckIn(uint placeid) public { userCount++; ...
0
votes
1answer
45 views

How long does a smart contract typically take to complete?

I have been developing an application using a smart contract, the application is similar to this one: https://www.ethereum.org/crowdsale I went ahead and initiated a request, below is the codebase ...
1
vote
2answers
937 views

This contract object doesn't have address set yet, please set an address first

I am in the final stages of developing an application that is similar to https://www.ethereum.org/crowdsale, however, when I click on the create button, my Metamask modal is not popping up to ask me ...
0
votes
0answers
44 views

Smart contract hanging in react

I'm trying to make a call to my smart contract and write data to my blockchain, which is successful. However, after that completes I want to make an entry in a firebase database. The code appears to ...
0
votes
0answers
30 views

web3 provider is set to null when try to access for second time

Hello i have issue with my app. I'm using truffle unbox react envoirment. I have simple component which render form and on submit i want to redirect. After i go back to form web3 is null. Here are ...
0
votes
0answers
8 views

Web3 lose state when url is chaging in react

I have a strange issue with my web3. Once when app is load my web3 is configured correct. I have a form on which I can submit some data to my contract and everything works great, but when I try to ...
0
votes
2answers
100 views

No “from” address specified in neither the specified in neither the given options nor the default options

So I already went through this query, but I still couldn't get my doubt solved. Be it any Blockchain Dapp, the same error is coming for me. I used the marriage certificate and kickstart examples. Can ...
0
votes
1answer
99 views

Request user to sign state changing transaction with metamask using Infura and web3js

Can't seem to find the right function to ask the user to sign a transaction via metamask, this is my code so far: const bet = '102500000000000010' const account = '...
0
votes
1answer
78 views

web3-core-method.umd.js:1191 Uncaught (in promise) Error: Transaction has been reverted by the EVM:

Keep getting this error and really not sure what's causing it. Smart contract: contract BasaltStore { // struct of how a document will be stored struct documentStore { // unique id of the ...