-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
Prerequisites
- I am using the correct version of React-Bootstrap for my version of Bootstrap
- I have searched for duplicate or closed issues
- I have read the contributing guidelines
Describe the bug
Since React 19 we are getting the following error
Invalid prop
stylesupplied toReact.Fragment. React.Fragment can only havekeyandchildrenprops.
This only appears when we pass <></> to OverlayTrigger overlay like this
This works
<OverlayTrigger overlay={<Tooltip>{tooltipText}</Tooltip>} placement={placement}>
<span>
<Button disabled={disabled}>
Test
</Button>
</span>
</OverlayTrigger>
Produces the error
<OverlayTrigger overlay={<></>} placement={placement}>
<span>
<Button disabled={disabled}>
Test
</Button>
</span>
</OverlayTrigger>
The reason why we pass <></> is to disable the tooltip for this overlay, maybe this is the wrong approach and we should not render the OverlayTrigger at all if we have no tooltip? But sometimes we only want a tooltip if a button is disabled. In this case we need a non existing tooltip for the enabled button.
There was no error in react 18, if this is the correct behavior and we simply should not pass <></> we will fix our button component.
Expected behavior
No error appears.
To Reproduce
Use react 19
<OverlayTrigger overlay={<></>} placement={placement}>
<span>
<Button disabled={disabled}>
Test
</Button>
</span>
</OverlayTrigger>
Reproducible Example
sorry
Screenshots
No response
What operating system(s) are you seeing the problem on?
No response
What browser(s) are you seeing the problem on?
No response
What version of React-Bootstrap are you using?
2.8.0
What version of Bootstrap are you using?
5.3.0
Additional context
No response