I have some trouble to create my popin
with all actions linked
I use REACT JS
I have a button like this:
<button className="b-circle" onClick={() => this.openPopin()}></button>
<div className="u-200">Frequence</div>
{OpenPopin ? <PopinComponent />: ''}
openPopin() {
this.setState({ openFrequency: true })
}
In the popinComponent
I have a cross , when I clicked on it I need to close the popin
and I need to detect click outside popin
to close it too
Do you have any solution to achieve this ? What is the best way ?
Thanks