React - onClick method not firing

I have an “export default” statement in addition to “class LikeButton”

export default class AppHeader extends React.Component {
  constructor() {
    this.state = {
      liked: false
    this.handleClick = this.handleClick.bind(this);
  handleClick() {
    this.setState({liked: !this.state.liked});
  render() {
    const text = this.state.liked ? 'liked' : 'haven\'t liked';
    return (
      <div onClick={this.handleClick}>
        You {text} this. Click to toggle.

but the body of the component is copied in from the api samples and still I do not see any event triggered nor function called.

AppHeader class being a child of a component hierarchy - could it be events are not passed down into the hierarchy.

Thank you for any help

Your missing the onClick={this.handleClick} in the render function from the example you linked to.

right, but when I press edit in the editor in here…

  <div onClick={this.handleClick}>
    You {text} this. Click to toggle.

is here… sorry must be a formatting error here…

any more ideas?

So hard to read… Enclose your code block inside triple quotes, like:

`` ` (without the extra space)

Your example are working here, fwiw.

@rhjulskov : thx for confirming this.

How could I proceed in finding the cause /debug code?

You probably have a click event handler further up the DOM that is calling something like event.stopPropagation()



fixed my issue…

logOut(event) {
      Meteor.logout(() => {