localstorage for login[reactjs]

im paratice my react and i have a idea but its not very well
i have a button and if user click on it say “WELCOME USER” so if button clicked say it and is not dont say it but is use localstorage and its not working
code:


    import { useState } from "react";

function App(){
    let [isLogin,setIsLoging] = useState(false)
    localStorage.setItem("isLogin",false)
    if(localStorage.getItem("isLogin") == "true"){
        return(
            <>
                <h1>Welcome user</h1>
            </>
        )
    }else{
        return(
            <>
                <button onClick={login}>login</button>
                
            </>
        )
    }
    function login(){
        setIsLoging(isLogin = true)
        localStorage.setItem("isLogin",true)
    }
}
 
export default App;

can anyone help?