-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
Is this a bug report?
No
Have you read the Contributing Guidelines?
Yes
Environment
OS: Windows 8
Node: 8.5.0
Yarn: Not Found
npm: 4.6.1
Watchman: Not Found
Xcode: N/A
Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed)
react-native: ^0.49.2 => 0.49.5
react: ^16.0.0-beta.5 => 16.0.0
Target Platform: Android (6.0)
Hi,
Goal is best performance. Which of below script result is better in performance (this is the renderItem
PureComponent of a large FlatList
):
1:
class MyComponent extends React.PureComponent {
constructor(props) {
super(props);
this.doWork = this.doWork.bind(this);
}
doWork() {
// doing some work here.
}
render() {
return <Text onPress={this.doWork}>Do Some Work</Text>
}
}
2:
class MyComponent extends React.PureComponent {
doWork = () => {
// doing some work here.
}
render() {
return <Text onPress={this.doWork}>Do Some Work</Text>
}
}
3:
class MyComponent extends React.PureComponent {
doWork(){
// doing some work here.
}
render() {
return <Text onPress={() => this.doWork}>Do Some Work</Text>
}
}
4:
class MyComponent extends React.PureComponent {
doWork(){
// doing some work here.
}
render() {
return <Text onPress={ this.doWork.bind(this) }>Do Some Work</Text>
}
}
5:
Your script...
Metadata
Metadata
Assignees
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.