react data attributes event
const removeId = e.target.getAttribute("data-remove");
react data attributes event
const removeId = e.target.getAttribute("data-remove");
how to get custom attribute value in react
//To Define the Custom attribute
// start with data- Like: data-remove={someValue}
<button onClick={this.removeItem} data-remove={item.id}>Remove</button>
//To Get Custom Attribute value
// Method 1:
const removeId = e.target.dataset.remove;
// Method 2:
const removeId = e.target.getAttribute("data-remove");
// Method 3:
const removeId = e.target.attributes.getNamedItem("data-remove").value;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us