I was trying to use react hooks inside conditional statement unfortunatly react gives you error for almost all the hooks and its intented as per hooks philosophy.
and then I tried useMemo hook inside else statement and it worked no errors. I googled around for this discrepancy and i didn't find anything promising.
My question, Is useMemo an exception that you can use useMemo in conditional statement.