Check out example codes for "if exist TempData[] c#". It will help you in understanding the concepts better.

Code Example 1

@if (TempData["SuccessMessage"] != null)
{
    <div class="success-message">
        @Html.Raw(@TempData["SuccessMessage"].ToString())
    </div>
}

Learn ReactJs, React Native from akashmittal.com