Commit d60030a1 authored by Martin Fahl's avatar Martin Fahl
Browse files

refactors onChange calls

parent 42dfaf41
......@@ -19,7 +19,7 @@ const AddDialog = ({ name, quantity, isOpen, handleClose, handleCancel, handleAd
id="name"
label="Name"
type="string"
onChange={updateName}
onChange={(event) => updateName(event.target.value)}
/>
</Grid>
<Grid item>
......@@ -28,7 +28,8 @@ const AddDialog = ({ name, quantity, isOpen, handleClose, handleCancel, handleAd
id="quantity"
label="Quantity"
type="number"
onChange={updateQuantity}
value={quantity}
onChange={(event) => updateQuantity(event.target.value)}
/>
</Grid>
</Grid>
......@@ -52,6 +53,6 @@ AddDialog.propTypes = {
handleClose: PropTypes.func.isRequired,
handleCancel: PropTypes.func.isRequired,
handleAdd: PropTypes.func.isRequired
};
}
export default AddDialog
\ No newline at end of file
......@@ -43,8 +43,8 @@ const mapDispatchToProps = (dispatch) => ({
handleClose: () => dispatch(closeAddDialog()),
handleCancel: () => dispatch(closeAddDialog()),
handleAdd: (name, quantity) => handleAdd(name, quantity, dispatch),
updateName: event => dispatch(updateAddDialogName(event.target.value)),
updateQuantity: event => dispatch(updateAddDialogQuantity(Number(event.target.value)))
updateName: newName => dispatch(updateAddDialogName(newName)),
updateQuantity: newQuantity => dispatch(updateAddDialogQuantity(Number(newQuantity)))
})
export default connect(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment