Before knowing about how to use useeffect in class component in react, you need to clear class component as well as functional component concept
you can't use useeffect in class component but if you want to use useeffect type effect in class component than you can use componentDidMount() and componentWillUnmount()
simple example for class component in react
checkStorage = (e) => {
if('keyStateYouWantToSync' == e.key && this.state.stateYouWantToSync != JSON.parse(e.newValue)){
this.setState({stateYouWantToSync: JSON.parse(e.newValue)})
}
}
componentDidMount(){
window.addEventListener('storage', this.checkStorage)
}
componentWillUnmount(){
window.removeEventListener('storage', this.checkStorage)
}
if you want to learn more about class component in react than you can check out freecodecamp