Office fabric React- TextField or any control
Why is it not possible to refer to a control(Eg., TextField) using this in it's events? What are the alternatives.
Category
- [x ] Question
- [ ] Typo
- [ ] Bug
- [ ] Additional article idea
Example: <TextField value='Testing events' autoAdjustHeight resizable={ false } title='Testing events' maxLength={150} onFocus={(newValue) => { this.multiline = true; //Here, this refers to the component where TextField is place and //not the TextField itself } } />
Expected or Desired Behavior
This within control events, should refer to the current control and not the component where control/component is placed
Observed Behavior
This within control events, refers to the containing control/component where current control/component is placed
Steps to Reproduce
Submission Guidelines
Thanks for your contribution! Sharing is caring.
Sorry for not responding, if you are using => notation, "this" points to your current class, not the TextField component.
Thanks :)
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues