Check out example codes for "ue4 c++ how to open a blueprint widget". It will help you in understanding the concepts better.

Code Example 1

// Where menu might be your widget.

    // Step 0 get player controller.
    auto PlayerController = GetFirstLocalPlayerController();
    if (!ensure(PlayerController != nullptr)) return;

    // Step 1 setup an input mode. There are multiple such as game only or game and UI as well.
    FInputModeUIOnly InputModeData;
    // Step 2 config is specific to the type
    InputModeData.SetWidgetToFocus(Menu->TakeWidget()); //Because UMG wraps Slate

    // Step 3 set the mode for the player controller

    // Step 4 enable cursor so you know what to click on:
    PlayerController->bShowMouseCursor = true;

Learn ReactJs, React Native from