New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closes #14, closes #15; Create dapp to register new owner, vehicle #23
Conversation
.then((result) => { | ||
const state = { ...this.state }; | ||
const machine = { | ||
model: model, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shorthand:
const machine = {
model,
make,
vin,
address: result.logs[0].args.newMachine
};
}) | ||
} | ||
|
||
callCreateMachine() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function does not return anything. I would suggest returning a value when defining functions.
form._disabled = !isValid; | ||
|
||
// Update state | ||
const state = { ...this.state }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { state } = this;
<div className="uk-container uk-container-center uk-margin-top uk-margin-large-bottom"> | ||
<div className="uk-grid-match" data-uk-grid-margin> | ||
<RegisterOwnerForm | ||
onSubmit={(e) => this.ownerFormSubmittedHandler(e)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onSubmit={this.ownerFormSubmittedHandler}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you would need to bind it to this
in the constructor first. Add to the constructor something like:
this.ownerFormSubmittedHandler = this.ownerFormSubmittedHandler.bind(this);
for all functions that refer to this
, obviously. That is very handy when passing the functions to child components.
<RegisterMachineForm | ||
onChange={(e) => this.machineFormChangedHandler(e)} | ||
onSubmit={(e) => this.machineFormSubmittedHandler(e)} | ||
state={this.state.forms.registerMachine} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you refer to this.state
more than once, it would be worth it to deconstruct it at the top of the function
const { state } = this;
or
const { forms, contracts } = this.state;
|
||
|
||
export default registerOwnerForm; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Basically the work looks really cool!
|
in fact, can we use ui kit from npm? |
I applied another commit, now we use ui kit from npm. |
Closes:
#14 Create dapp to register new owner
#15 Create dapp to register new vehicle
Changes proposed:
@michalmikolajczyk I'd appreciate your feedback