onClick Not Updating

The text is displaying in the browser, but when I click the button nothing changes.
Code:

class App extends Component {
    constructor() {
        super()
        this.state = {
            isLoggedIn: false
        }
        this.handleChange = this.handleChange.bind(this)
    }
    
    handleChange() {
        this.setState(prevState => {
            return {
            isLogginedIn: !prevState.isLoggedIn
            }
        })
    }
    render() {
        return(
            <div>
            <h1> You are {this.state.isLoggedIn ? 'logged in' : 'logged out'}</h1>
            <button onClick={this.handleChange}>Log {this.state.isLoggedIn ? 'out' : 'in'}</button>
            </div>
        )
    }
}
          return {
            isLogginedIn: !prevState.isLoggedIn
          }

I’m guessing the problem is the “isLogginedIn” property.

1 Like

Darn typos haha. Thank you!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.