<commit_before>---
layout: post
title:  "ES6 Gotchas"
excerpt_separator: <!--more-->
author: <NAME>
date: 2015-05-25 14:00
published: true
categories: react
---

With ES6 components, there are a few "aha" moments and annoyances. This post was created so that you don't have to go through some of the struggles myself and others have gone through.
<!--more-->
**Function Bindings**

~~~js
<div onClick={this.handleClick} />
~~~

What's wrong with that? If you're not using `React.createClass`, which autobinds functions, you need to do it yourself. The correct way would be add it to constructor:
<commit_msg>website build<commit_after>---
layout: post
title:  "ES6 Gotchas"
excerpt_separator: <!--more-->
author: <NAME>
date: 2015-05-25 14:00
published: true
categories: react
---

With ES6 components, there are a few "aha" moments and annoyances. This post was created so that you don't have to go through some of the struggles myself and others have gone through.

<!--more-->

**Function Bindings**

~~~js
<div onClick={this.handleClick} />
~~~

What's wrong with that? If you're not using `React.createClass`, which autobinds functions, you need to do it yourself. The correct way would be add it to constructor:

{'fraction_non_alphanumeric': 0.11494252873563218, 'fraction_numerical': 0.022988505747126436, 'mean_word_length': 4.3464912280701755, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6252364', 'n_tokens_mistral': 387, 'n_tokens_neox': 355, 'n_words': 167}