I want to use the React Drizzle contract form to display a form that can take multiple data elements i.e. will display an input box for name and nationality. So this is a simple example that slightly expands on the set and get methods on the drizzle unbox react example which just gets and sets a single variable. Avaiable here https://github.com/truffle-box/react-box
My smart contract is ..
pragma solidity 0.5.16;
contract PersonContract {
uint256 public peopleCount = 0;
mapping(uint => Person) public people;
struct Person {
uint256 _id;
string _firstname;
string _lastname;
}
function addPerson(string memory _firstname, string memory _lastname) public{
incrementPeopleCount();
people[peopleCount] = Person(peopleCount, _firstname, _lastname);
}
function incrementPeopleCount() internal {
peopleCount +=1;
}
}
And my React code inside MyComponent is ...
<div className="section">
<h2>Person Contract</h2>
<p>
<ContractData
drizzle={drizzle}
drizzleState={drizzleState}
contract="PersonContract"
method="Person"
/>
</p>
<ContractForm drizzle={drizzle} contract="PersonContractTwo" method="addPerson" />
</div>
When I run this code I get errors for both the ContractData and ContractForm.
For the ContractForm I get ...
drizzle-react-components.js:392 Uncaught TypeError: Cannot read property 'methods' of undefined
and for the ContractForm I get ..
index.js:1406 uncaught at initializeDrizzle TypeError: Cannot read property 'abi' of undefined
Could anyone tell me what I am doing wrong or point me in the direction of any code examples that involve Drizzle contract forms that involve multiple input elements. Much appreciated.