Skip to content

Instantly share code, notes, and snippets.

@jokamjohn
Created May 17, 2018 08:17
Show Gist options
  • Save jokamjohn/5d45ff302c90d5508a2fb57493f130ad to your computer and use it in GitHub Desktop.
Save jokamjohn/5d45ff302c90d5508a2fb57493f130ad to your computer and use it in GitHub Desktop.
import React from 'react';
import PropTypes from 'prop-types';
export const AddItem = ({name, price, onChange}) => (
<div className="row justify-content-center">
<form className="form-inline">
<input
type="text"
className="form-control mb-2 mr-sm-2"
placeholder="Item"
value={name}
name="name"
onChange={onChange}
/>
<div className="input-group mb-2 mr-sm-2">
<input
type="text"
className="form-control"
placeholder="Price"
value={price}
name="price"
onChange={onChange}
/>
</div>
<button type="submit" className="btn btn-primary mb-2 pxy-4">Save</button>
</form>
</div>
);
AddItem.propTypes = {
name: PropTypes.string.isRequired,
price: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment