1

I have a sliding-menu component. It has items and I want to hide the menu when I click on each item. But if i click on Now I did so:

<nav onClick={this.handleClickCloseMenu}>
  <Link
    to="/smth"
    activeClassName="is-active"
  >
    smth
  </Link>
  <Link
    to="/smth2"
    activeClassName="is-active"
  >
    smth2
  </Link>
</nav>
    

Now I have an eslint errors: jsx-a11y/no-noninteractive-element-interactions end jsx-a11y/no-static-element-interactions I can set role button to nav but i guess it is wrong way. What do you think about?

platypussss
  • 159
  • 8

1 Answers1

0

I thought a little and decided to tie into the key parameter, it's generated by react-router. In componentDidUpdate, look at the key and if the current one differs from the previous one, then hide the menu. If it is open of course. streletss thank you for pushing a thought

platypussss
  • 159
  • 8