So I have a login box and a registration box. I'm trying to update the view if register is clicked. the boolean is changing in the console but the view is not
index.ejs
    <%- include('partials/header') -%>
<% if (locals.isAuthenticated) { %>
    <p>You are logged in. <a href="/profile" class="underline">View your profile</a>.</p>
<% } else if (!this.isRegister) { %>
    <%- include('partials/loginbox') -%>
<% } else { %>
    <%- include('partials/registerbox') -%>
<% } %>
<%- include('partials/footer') -%>
script in body in footer.ejs:
<script>
    var isRegister = false;
function register() {
    this.isRegister = !this.isRegister;
    console.log(this.isRegister);
    return this.isRegister
};
</script>
button in loginbox.ejs:
                   <button type="button" class="btn btn-primary" onClick="register()">Register</button>
