Tuesday, June 19, 2018

Why exactly does onClick for React have to be an arrow function rather than a regular function?


For example within render, if I write,
  • this.setRecipeList(index)}> {article.genre}
  • it works fine, but if I write
  • {article.genre}
  • the function setRecipeList(index) gets called? via /r/webdev https://ift.tt/2tiQFYJ

No comments:

Post a Comment