How to define variable in useEffect in React? Below is my variable getting firstname from localStorage: