Skip to content

Commit 83f17ab

Browse files
authored
Fix wrapper className for ssr hydrate
Fix hydrate issue ```javascript Warning: Prop className did not match. Server: "__react_component_tooltip place-top type-dark" Client: "__react_component_tooltip place-top type-dark " ``` [Hydrate documentation](https://reactjs.org/docs/react-dom.html#hydrate).
1 parent 11ee685 commit 83f17ab

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,10 +569,11 @@ class ReactTooltip extends React.Component {
569569
if (ReactTooltip.supportedWrappers.indexOf(Wrapper) < 0) {
570570
Wrapper = ReactTooltip.defaultProps.wrapper
571571
}
572+
const wrapperClassName = [tooltipClass, extraClass].filter(Boolean).join(' ');
572573

573574
if (html) {
574575
return (
575-
<Wrapper className={`${tooltipClass} ${extraClass}`}
576+
<Wrapper className={wrapperClassName}
576577
id={this.props.id}
577578
ref={ref => this.tooltipRef = ref}
578579
{...ariaProps}
@@ -581,7 +582,7 @@ class ReactTooltip extends React.Component {
581582
)
582583
} else {
583584
return (
584-
<Wrapper className={`${tooltipClass} ${extraClass}`}
585+
<Wrapper className={wrapperClassName}
585586
id={this.props.id}
586587
{...ariaProps}
587588
ref={ref => this.tooltipRef = ref}

0 commit comments

Comments
 (0)