Rendering UI Component at onclick

I am just working on a project, I just wanted to ask that can we do ui component rendering at onclick.

Example:

<div name="log-in" onclick={<Login/>}>                  
</div>

suppose that login component is created

I am just expecting a concise explanation, opinion regarding good practices or alternative in compare to what I was trying to do.