I am reading the Thinking in React documentation at https://facebook.github.io/react/docs/thinking-in-react.html
In the last part of the document https://facebook.github.io/react/docs/thinking-in-react.html#step-5-add-inverse-data-flow, I can't understand the use of bind(this) and how it is working. Specifically, I am trying to understand:
Why we need these two lines in the SearchBar component:
this.handleFilterTextInputChange = this.handleFilterTextInputChange.bind(this);
this.handleInStockInputChange = this.handleInStockInputChange.bind(this);
And the following two lines in the FilterableProductTable component:
this.handleFilterTextInput = this.handleFilterTextInput.bind(this);
this.handleInStockInput = this.handleInStockInput.bind(this);
What will happen if we don't to these binds?
I have read the documentation for the JavaScript bind function and some examples on inverse data flow that I found on Google but still can't get my head around it.
Would appreciate if someone could deconstruct the data flow and what this
refers to in each instance.