parent
6f39767043
commit
3ae33d1fab
@ -0,0 +1,15 @@
|
|||||||
|
Detect tab change in react, class base:
|
||||||
|
|
||||||
|
```
|
||||||
|
componentDidMount() {
|
||||||
|
window.addEventListener("focus", this.onFocus)
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
window.removeEventListener("focus", this.onFocus)
|
||||||
|
}
|
||||||
|
|
||||||
|
onFocus = () => {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
```
|
Loading…
Reference in new issue