'use solidity function in react
I have a solidity function to add data so I wanna create some textbox and a button in react to add the textbox data to blockchain
there is my solidity code
pragma solidity 0.6.4;
contract Storage{
uint [] public ids;
string [] public activityNames;
string [] public authorNames;
string [] public activityTypes;
function add(uint id, string memory activityName, string memory authorName, string memory activityType) public {
ids.push(id);
activityNames.push(activityName);
authorNames.push(authorName);
activityTypes.push(activityType);
}
and this is my react set handler code but only adds one value So I wanna make the set handler add all the 4 values not only one
const setHandler = (event) => {
event.preventDefault();
contract.add(event.target.setText.value);
}
Thanks
Solution 1:[1]
your contract signature is expecting 4 values but you are only passing a single one in when you call it, fill out the rest of the values expected and it should work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mynameisgeoff123 |
