1 min readApr 10, 2019
Yes. Because you have passed method directly into map, “this” of that method is pointing to different scope.
So you can change renderItem to be arrow function or
<div>
{ items.map(item => this.renderItem(item)) }
</div>
Yes. Because you have passed method directly into map, “this” of that method is pointing to different scope.
So you can change renderItem to be arrow function or
<div>
{ items.map(item => this.renderItem(item)) }
</div>
Distraction-free reading. No ads.
Organize your knowledge with lists and highlights.
Tell your story. Find your audience.
Read member-only stories
Support writers you read most
Earn money for your writing
Listen to audio narrations
Read offline with the Medium app
Full-stack developer - react.js, node.js, serverless. @machnicki