08/19/2021 18:05 | Category: javascript

Tags: reactgatsbyjs

react object events and what to link with

During my personal site revamp I started learning React and noticed that I had some errors when I was trying to assign a link to a <div>. These were both the linting and functional errors regarding what we "should" do to elements.

After reading up I found a few StackOverflow posts that correctly describe the behavior we should have.

Posts:

  1. Overall explanation
  2. Keyboard listeners
  3. Event handlers

Loose rendition of the code I was using:

<div
  onClick={event => (navigate(/posts))}
>

Errors I received:

> Visible, non-interactive elements with click handlers must have at least one keyboard listener.
> Static HTML elements with event handlers require a role.