I am looking for a solution to render React content conditionally based off the user's Operating System.
Eg. I have a simple component that displays keyboard shortcuts to interact with another component I'm using. In this case, the keyboard shortcuts for Windows and Linux are meant to show ctrl + [action]. But for MacOS it needs to show cmd + [action].
Here's my component:
import React from 'react';
import { ShortcutsContainer, MetaRow } from '../../styles';
const Shortcuts = () => (
  <ShortcutsContainer>
    <h1>Keyboard Shortcuts</h1>
    <MetaRow>
      <strong>ctrl + click</strong>
      <span> to start editing value</span>
    </MetaRow>
    <MetaRow>
      <strong>ctrl + Enter</strong>
      <span> to submit changes</span>
    </MetaRow>
    <MetaRow>
      <strong>Escape</strong>
      <span> to cancel editing</span>
    </MetaRow>
  </ShortcutsContainer>
);
export default Shortcuts;
Let's take <strong>ctrl + click</strong> from that.
What I want is to have something like this:
<strong>{getUserOS() === 'MacOS' ? 'cmd' : 'ctrl'} + click</strong>
How would I accomplish that? Been struggling to find a way to get the user's OS.
 
     
     
    