-
Hi, I'm trying send data attributes along with IButtonProps. Gettig this following error. Object literal may only specify known properties, and '[ |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is because the type // explicitly typed for the data- attribute, without sacrificing type safety for the other button props
const buttonData = { 'data-testid': dataWorkspace.panel.addNewTable } as IButtonProps;
buttonProps={{
id: StudioTourHooks.NEW_TABLE_BUTTON,
text: formatMessage({ id: LocalizationConstant.TABLE }),
onClick: AddTableButtonClick,
ariaLabel: formatMessage({ id: LocalizationConstant.ADD_TABLE_BUTTON_ARIA_LABEL }),
iconProps: { iconName: IconNames.Add },
...buttonData
}} Hope that helps! |
Beta Was this translation helpful? Give feedback.
This is because the type
React.AllHTMLAttributes
does not includedata-*
attributes. A workaround would be something like this:Hope that helps!