I have a hook function/file in which i want to export a state called 'isAuth'. When I try to import this state in another file as import {isAuth} from '../AuthService/AuthRoute' i get an attempted import error. My plan is to set and get this state globally in my react application
This is how I want to export the state from the hook function/compenent:
export default function AuthRoute () {
const [isAuth, setIsAuth] = useState(false);
return {isAuth}
}
This is how I plan to import the state
import {isAuth} from '../AuthRoute/AuthRoute'
function Login () {
const [usernameAuth, setUsernameAuth] = useState("");
const [passwordAuth, setPasswordAuth] = useState("");
const [loginStatus, setLoginStatus] = isAuth(); //Imported state
const [inputResponse, setInputResponse] = useState("");