const MyInput = props => {
const { onChange } = this.props;
const id = this.props['data-id'];
const name = this.props['data-name'];
return <input onChange={onChange} data-id={id} data-name={name} />;
};
const MyInput = ({ onChange, ...rest }) => <input onChange={onChange} {...rest} />;
onChange = e => {
const { id, name } = e.target.dataset;
// do something with id and name
}