title: Scroll with keyboard's up/down arrows keys in React?
body: <p>I have a custom listbox, a <code>div</code> that contains a vertical list of other <code>div</code> children. I want to add an up/down arrows keys navigation to change which child is currently selected.</p>
  
  <p>So when I click the first item and press the <code>down arrow key</code>, it should allow me to select the second item (following item). And if I click the <code>up arrow key</code>, it should select back the first item (previous item).</p>
  
  <pre><code>const renderInboxSummary = targetDetailsData.map((todo, index) =&gt; {
    const hasNewMessageInd = todo.hasNewMessageInd;
    return (
     &lt;div onClick={() =&gt; this.handleClick(targetDetailsData, todo.aprReference, index)}&gt;
        &lt;div&gt;
          {todo.aprRecordUserName}
        &lt;/div&gt;
        &lt;div&gt;
          {todo.aprBranchCode}
        &lt;/div&gt;
        &lt;div&gt;
          {todo.aprScreeName}
        &lt;/div&gt;
    &lt;/div&gt;
    );
  });
  </code></pre>
  
  <p>Every <code>div</code> has a click event handler <code>this.handleClick(targetDetailsData, todo.aprReference, index)</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/8ySHk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8ySHk.png" alt="Enter image description here"></a></p>