class homeNotLoggedIn extends React.Component {
componentDidMount() {
function logout(){
localStorage.clear()
location.reload()
}
}
render() {
return (
<div>
<div className="nav_bar">
<button id='logout' onClick={ logout() }>
Im stuck here because I can't move the function out of componentDidMount
because I need localStorage and the location property from the client, I know its going to say "logout is not defined" but I do not know how do I define it in this case