Check out example codes for "unity key detection". It will help you in understanding the concepts better.

Code Example 1

if (Input.GetKeyDown(KeyCode.Space))
        {
            print("space key was pressed");
        }

Code Example 2

void Update()
    {
        if (Input.GetKeyDown("space"))
        {
            print("space key was pressed");
        }
    }

Code Example 3

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    void Update()
    {
        if (Input.GetKeyDown("space"))
        {
            print("space key was pressed");
        }
    }
}

Code Example 4

KeyDown

Learn ReactJs, React Native from akashmittal.com