Tooltip
This example shows how to implement a custom attribute and pass parameters with it.
It implements a $tooltip
directive that shows a custom tooltip when element is hovered.
Visit the source code of this example to see the implementation.
Usage
function App() {
return (
<div>
<button $tooltip={'Secret tooltip here'}>Hover the mouse over me to see a tooltip</button>
</div>
);
}
http://localhost:3000
Secret tooltip here
Typescript types
declare module 'react' {
interface Attributes {
$tooltip?: ReactNode;
}
}