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(ignore the comments)
OTPSubmit(event) {
event.preventDefault();
//alert('A name was submitted: ' + this.state.value);
this.setState({
showComponent: true,
account: this.web3.eth.personal.newAccount()
#account: this.web3.eth.accounts.create()
});
}
These are the errors I'm getting
- web3.eth.accounts.create() is not a function
- Cannot read property 'newAccount' of undefined
Can you please help me? I am very new to this