I'm pretty confident i'm doing this wrong, i'm unable to console.log this.state.greeting however if I reference this.state.greeting inside the return statement it works, i'm confused why it doesn't work within the class method
class Test extends React.Component {
  constructor (props) {
    super(props)
    this.state = {
      greeting: 'test'
    }
  }
  greeting () {
    console.log(this.state.greeting)
  }
  render () {
    return (
      <p onClick={this.greeting}>test</p>
    )
  }
}
export default Test
 
     
    