import React from "react"; import Link from "next/link"; export default class InnerMenu extends React.Component { constructor(props) { super(props); this.state = { type: undefined }; this.menuRef = React.createRef(); } componentDidMount() { const hash = this.props.router.asPath.split('#')[1]; this.setState({ type: hash }); } componentDidUpdate(prevProps, prevState) { const hash = this.props.router.asPath.split('#')[1]; if(this.state.type !== hash) { this.setState({ type: hash }); } } render() { console.log("Events", "InnerMenu", "this.props.router", this.props.router); const { type } = this.state; return ( ) } }