Shopify Polaris > How to get the key when onRemove called?

achieveapplabs
Shopify Partner
470 36 74

How do I get the key value here when a tag is removed?

 

<Tag key={place.id} onRemove={this.handleRemove}>{place.city}</Tag>

 

 

this.handleRemove(e) {

 

   //e returns a class, how do I get the key?

   console.log(e);

}

 

 

"@shopify/app-bridge": "^1.19.0",
"@shopify/app-bridge-react": "^1.14.0",
"@shopify/polaris": "^4.21.0",
"@shopify/polaris-icons": "^3.8.0",
"@shopify/shopify-express": "^1.0.0-alpha.7",

 

Thanks,

 

Sam

Install Approovly to create and track order approvals | We want to hear from you hello@achieveapplabs.com | Follow us on Twitter @achieveapplabs | Custom Shopify Apps achieveapplabs.com
0 Likes
achieveapplabs
Shopify Partner
470 36 74

This works!

 

	handleRemove(place){ 

		var tagText = $(place.currentTarget).parent()[0].innerText;

	}

<Tag key={place.id} onRemove={this.handleRemove} children={place.city}></Tag>
Install Approovly to create and track order approvals | We want to hear from you hello@achieveapplabs.com | Follow us on Twitter @achieveapplabs | Custom Shopify Apps achieveapplabs.com
0 Likes