Reputation: 1765
I used to have this and it worked fine:
<div className="right mr3 relative center" style={{ marginTop: -300, zIndex: 2 }}>
Now I need to pass that entire class and inline style as props,
tooltipClassName={"right mr3 relative center" style={{ marginTop: -300, zIndex: 2 }}}
And then call that class like this <div className={tooltipClassName}>
Maybe I need to use string interpolation or pass another prop as styles but I don't know.
Upvotes: 0
Views: 7067
Reputation: 2407
Class & style are different HTML attributes, so string interpolation won't really work here. One option:
<SomeComponent tooltipClasses={'right mr3 relative center'} tooltipStyles={{ marginTop: -300, zIndex: 2 }} />
// inside of SomeComponent render:
<div className={this.props.tooltipClasses} style={this.props.tooltipStyles}>
Alternately you could write your own class with the z-index and margin values and add that class to the array
Upvotes: 2