title: What does the ternary operator mean in the code snippet using javascript?
body: <p>I want to understand what the code below does with ternary operator. Right now it is hard to me to decode with ternary operator.</p>
  <p>Could someone help me understand what this code does?</p>
  <pre><code>const handleSelection = React.useMemo(
      () =&gt;
          page.map(row =&gt; {
              return singleSelect
                  ? toggleSingleSelection
                      ? () =&gt; toggleSingleSelection(row)
                      : undefined
                  : toggleSelection
                  ? () =&gt; toggleSelection(row)
                  : undefined;
              }),
        [toggleSelection]
    );
  </code></pre>