Hi I am passing an object to anchor tag like this
<a
data-message= {message.data}
id={`${this.uid}_primaryAction_${id}`}
href="#"
onClick={
this.handlePrimaryActionClick
}
>
<span>{primaryButtonText}</span>
</a>
and in handlePrimaryActionClick function I am accessing the data like below.
private handlePrimaryActionClick = (event: MouseEvent) => {
event.preventDefault();
const elem = event.target as HTMLElement
const message = elem.parentElement.dataset.message;
};
But I am getting message as string , It should be object . Is anything wrong?