Consider the usecase. I want to have a tooltip functionality in my react application. The way I want to set it up is when I write <input type="text" tooltip="Enter your name here">, this should apply tooltip saying "Enter your name here" on the textbox. This should be applicable to any eligible element in my app. So that whenever I need to apply a tooltip on any element, I just need to write tooltip="..." attribute on it.
I am familiar that in AngularJS you might go about it something like this.
angular.module('app')
.directive('tooltip', function() {
return {
restrict: 'A',
link: function($scope, $el) {
// Apply Tooltip through JS or applying right CSS class
}
}
}
But I am not sure if there's something similar available in React. Or may be if it needs to be constructed, how should I approach creating something like this.