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
vote
0answers
322 views

Drizzle React Component ContractData for array returns empty

<ContractData contract="TheContract" method="getData" methodArgs={[accounts[0], "0", { from: accounts[0] }]} /> and a contract view function function getData() public view returns (...
0
votes
1answer
256 views

Truffle with Drizzle fails with TypeError: str.slice

Using Drizzle ran into a problem. Can anyone help? There are several get functions 1-st works fine both in the truffle console and at the frontend, function without arguments truffle console: input:...
1
vote
1answer
564 views

Truffle Drizzle ContractData call keccak256 error

I started with truffle unbox drizzle then made use of my contract. I can make use of the ContactForm without error in App.js: <ContractForm contract="TheContract" method="addData" labels={["...
0
votes
1answer
451 views

Metamask issue with payable transactions using Truffle and Web3

Hope everyone's doing well. For the past few days I've been having issues with a payable function which I know is definitely working. How do I know it's working? Ether gets sent successfully on Remix....
6
votes
3answers
8k views

How to import web3 into a React project

I apologize preemptively for the very basic question. I have added and installed web3 using yarn in my react project. Inside my index.js file in /scr and based on the web3 docs I have tried both (...
1
vote
1answer
648 views

Frontend side of DApp

I am (totally new to DApp) currently involved in a research project that regarding the Front-end side (Js Libraries and Frameworks) of the DApp. I read many articles but still confused. My ...
3
votes
2answers
2k views

Listening for events in a React DApp

I am new to React and don't know where I should put the code to .watch() for Solidity events. Right now, I the code in a member function of my main App class. As is, I am successfully capturing ...
1
vote
1answer
672 views

React: Incorporating event listening into web3js promise

I have the following React component: class Parent extends Component { constructor(props) { super(props) this.state = { id: this.props.id, age: 0, web3: null, } ...
0
votes
2answers
418 views

React + Web3, making call from componentDidMount but web3 not ready?

I'm trying to load some data from a smart contract from within componentDidMount. Calling the contract from within here didn't seem to work as web3 provider wasn't ready, so I added an event listener ...
3
votes
1answer
770 views

React: Re-render states after MetaMask transaction

The React frontend of my dapp successfully fetches the data from the private blockchain (Ganache) and updates the states accordingly. However, when I trigger a function via onClick that updates the ...
0
votes
1answer
867 views

React/Truffle: How to call a function with passing a variable?

I have a React component within which a web3js function queries numbers from Ethereum by using getNumber() function. I want to call another function called setNumber() that takes one uint256, by ...
0
votes
2answers
196 views

Drizzle component returns BigNumber

I am using the following Drizzle (Truffle) component to call a function from a smart contract: <ContractData contract="Market" method="priceOf" methodArgs={this.props.id}/> The result is a ...
11
votes
3answers
10k views

How to convert from Wei to Ether in React?

In React, I use a Web3js call function to get a value. The returned value is in Wei. However, I want to render it in Ethers. What would be the best way to do it?
0
votes
1answer
393 views

Calling a Solidity function from React

The contract: pragma solidity ^0.4.19; contract Info { /* some other setters */ function ageOf(uint256 _tokenId) public view returns (uint256 age) { return ages[_tokenId]; } ...
1
vote
2answers
188 views

Create-React from truffle: “return this.setState({ storageValue: result.c[0] })”

In the Create-React box from Truffle, why do we retrieve a uint value from a function call with "result.c[0]" instead of "result"? What's the c[0]?
1
vote
0answers
289 views

Web3 Eth Filter does not seem to work

I am using Ganache as my test network and I am running React as my front end. My ComponentWillMount() is as follows: componentWillMount() { getWeb3 .then(results => { this.setState({ ...
0
votes
1answer
532 views

inject web3 in electron-ethereum-react desktop application

I am trying to make ethereum-electron-react application. when I try to inject web3 it does not get detected. import Web3 from 'web3'; console.log (Web3); this shows an empty object even though ...
2
votes
1answer
626 views

Solidity events on react not firing

Simple logic event with firing in function, work perfectly as expected in truffle develop console, but never firing on my Dapp created with create-react-app, it's just seems to not listen/monitor the ...
2
votes
1answer
1k views

Web3 not defined

I am following this tutorial here: https://medium.com/@merunasgrincalaitis/the-ultimate-end-to-end-tutorial-to-create-and-deploy-a-fully-descentralized-dapp-in-ethereum-18f0cf6d7e0e after running ...
2
votes
0answers
350 views

Truffle constant functions run out of gas, how to simulate a local node

I am new to solidity and web3. I am getting familiar with Truffle, testrpc and web3 1.x. I am also using React as a front end. I know that functions that don't change the smart contract state can ...
0
votes
2answers
785 views

truffle/web3 event listeners returns nothing

We have an event being triggered in a contract and our listeners on the client cant receive the return value. https://gist.github.com/stupeters187/9529b54fe0d48ee606ad06ced6b16031 Update: metamask ...
0
votes
1answer
65 views

React returns Error 'TypeError: ETHEREUM_CLIENT.eth.contract is not a function' when I trying to connect to my ethereum contract

I declared the variables as follows import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; import Web3 from 'web3'; var ETHEREUM_CLIENT = new Web3(new Web3....
0
votes
1answer
477 views

Accessing Web3 in trufflebox's react-auth-box

Hi I am using trufflebox boilerplate react-auth-box. Created a new component called Foo where I am trying to access the web3 object that has been mapped from Store to this.props. However the console....
1
vote
0answers
573 views

“Truffle unbox react” Not Working Properly

I am facing problems running the basic official setup of react and truffle. Here's what I did: truffle init truffle unbox react truffle develop truffle(develop)> compile truffle(develop)> ...
1
vote
1answer
1k views

Build an Ethereum Wallet using React [closed]

Using React js i am trying to create a wallet I want to implement few functionalities 1) display balances of all the accounts 2) Display tokens by providing smart contract address how can i ...
1
vote
0answers
79 views

Is the following model correct for a DAPP?

I am trying to make a DAPP using React Native. I have made a flowchart of all the pieces i need to build in order for it to work. I was hoping if someone could verify it so that I can start working ...
4
votes
3answers
596 views

Why is MeteorJS so popular for making dApps?

I am learning more about creating a front end that communicates with solidity contracts. At first, I was pointed in the direction of using ReactJS, but now I see many people talking about using ...
0
votes
1answer
760 views

Truffle always exceeds my gas limit

In truffle saving 1 struct exceeds the default gas of testrpc. Is this function poorly written, or is this common in truffle. VM Exception while processing transaction: out of gas solidity pragma ...
2
votes
3answers
2k views

Accessing web3 object in Chrome terminal using React

I am receiving a "not defined" error when trying to access the web3 object in Chrome terminal. My current setup: running testrpc web3 object successfully instantiated in App.js built app using React ...
0
votes
1answer
286 views

Displaying AccountBalance via Geth and Web3

I am throwing together a sample app. I want to query an address and display its account balance. In the constructor of my React component, I am querying a random address: constructor(props) { ...
2
votes
1answer
6k views

TypeError: (intermediate value).at is not a function

This is my code: import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; import Web3 from 'web3'; var ETHEREUM_CLIENT = new Web3(new Web3.providers.HttpProvider("...
2
votes
1answer
614 views

Solidity Truffle React TestRPC: Invalid address error while creating transactions through React app

I am writing a simple contract which is basically a registry. I am using testRPC for my ethereum testing. Following is my contract on Truffle: notary.sol pragma solidity ^0.4.11; contract notary { ...
1
vote
1answer
243 views

React Webpack Boilerplate for Blockchain

Somebody suggested that I not use Truffle if i want to go into production mode. Is there a React Webpack boilerplate for Blockchain? If so, please point me in the right direction.
5
votes
1answer
2k views

“this._eth.sendTransaction is not a function” when executing method in Web3

I'm using react-web3 (which basically gives me a web3 object back) and I'm trying to make my contract work. This is the code I'm using: const web3 = window.web3; const contract = new web3.eth....
1
vote
0answers
820 views

How to fix 'Waiting for roots to load…' in react-devtools for a dApp?

I am building a Parity UI dApp from the Skeleton dApp at https://github.com/paritytech/skeleton and I want to debug it with Facebook's react-devtools Since Parity renders the dApp in an iframe, I ...
1
vote
1answer
3k views

How to map a web3 to a react.js state

How would you map a changing variable from web3 to react.js component? Example: class App extends Component { constructor(props){ super(props); this.state = { blockNumber: web3.eth....
1
vote
1answer
671 views

Undefined in truffle-contract initialization

why I always have undefined from contract(_contract).setProvider(this.web3Provided); Component: import React, {Component, PropTypes} from 'react'; import { default as Web3 } from 'web3'; import { ...
5
votes
3answers
5k views

Build an application with Truffle + React + Redux

I'm looking for some examples about how to build a Dapp with Truffle + React + Redux. I'm able to only find this old tutorial https://www.youtube.com/watch?v=GPP6uAq15d8. Does anyone have some other ...

1 2 3 4
5