The onClick attribute can be used without issue on <Icon /> components in JavaScript as follows:
<Icon className="helpButton" path={mdiHelpBox} onClick={() => showHelp(helpModalData)} />
However in Typescript, I get the following error:
Property 'onClick' does not exist on type 'IntrinsicAttributes & IconProps'.ts(2322)
It would appear that the intended way of resolving this is to wrap the <Icon /> in an additional element and give the outer element the onClick attribute.
It would be nice if onClick attributes could be given directly to Icon components, especially considering that there is no issue with doing so at runtime.
The
onClick
attribute can be used without issue on<Icon />
components in JavaScript as follows:<Icon className="helpButton" path={mdiHelpBox} onClick={() => showHelp(helpModalData)} />
However in Typescript, I get the following error:
Property 'onClick' does not exist on type 'IntrinsicAttributes & IconProps'.ts(2322)
It would appear that the intended way of resolving this is to wrap the
<Icon />
in an additional element and give the outer element theonClick
attribute.It would be nice if
onClick
attributes could be given directly to Icon components, especially considering that there is no issue with doing so at runtime.