'Semantic UI React Popup(s) Not Appearing

See title.

Code is literally

<Popup
trigger={<li id="close"><a>Close</a></li>}
content="Click to close"
basic
/>

And yeah when the item in question is hovered, or clicked, the popup doesn't appear. When I set open={true} it does, not attached to the component (as expected). Has anyone encountered this issue and could they advise possible solutions?



Solution 1:[1]

I just rewrote your code and it works! However, in case you wanna control the popup with an open attribute, you should create a state for it and handle popup opening with an onMouseOver function.

For example: you define a state named isPopupOpen and set it to false by default.

this.state={
isPopupOpen : false
}

then you handle the situation with two methods:

handleMouseOver = () => this.setState({ isPopupOpen: true })

handleMouseOut = () => this.setState({ isPopupOpen: false })

and finally write the popup this way:

                <Popup 
                trigger={
                    <li 
                    id='close'
                    onMouseOver={this.handleMouseOver}
                    onMouseOut={this.handleMouseOut}
                    >
                        <a>Close</a> 
                    </li>
                }
                content={'click to close'}
                basic
                open={this.state.isPopupOpen}
            />

Solution 2:[2]

You would need position property

<Popup
trigger={<li id="close"><a>Close</a></li>}
content="Click to close"
basic
position="top left"
/>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 sushmitha reddy