In the below Code of React. head variable is defined below HeadingComponent function. Then why it is not throwing error ?
const HeadingComponent= ()=>{
return(
<>
{head}
<h1>Hi, This is Heading Component</h1>
</>
)
}
const head=<p>This is head</p>```
In the above code we have defined head using "const" which is not hoisted on the top of the scope. So, it should throw an error but Why it is working fine?