A
A
Alexander Shtang2015-10-28 09:01:08
React
Alexander Shtang, 2015-10-28 09:01:08

How to make a tooltip in React?

Let's say we have this code:

var someVariable = React.createClass({
render: function() {
                    return React.createElement('div', {className: 'drivers-shifts'},[
                        React.createElement(Hsvg, {href: 'car', cssClass: "car-md car-icon"}),
                        React.createElement('h2', {className:'margin'}, this.state.values.free),
                        React.createElement(Hsvg, {href: 'driver', cssClass: "driver-md driver-icon"}),
                        React.createElement('h2', {className:'margin'}, this.state.values.onShift)]
                    )
                }
});

And for the svg icon, I need to make a tooltip. How? I tried data-tooltip. Also tried this and here it is .
But, experience is not enough, and I can not catch up with how to do it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Shtang, 2015-10-29
@Enclave88

The solution turned out to be in additional nesting:

React.createElement('div', {className: 'car-icon_wrap tooltips', 'data-tooltip': 'Свободные водители'},
                            React.createElement(Hsvg, {href: 'car-icon', cssClass: "car-md car-icon -online "})
                        ),
React.createElement('h2', {className:'margin'}, this.state.values.free),

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question