mirror of
https://github.com/vector-im/element-web.git
synced 2025-10-01 18:41:05 +02:00
clarify event handlers
This commit is contained in:
parent
afa6acc20a
commit
1a3bc814e1
@ -151,7 +151,7 @@ React
|
||||
<Foo onClick={function(ev) {doStuff();}}> // Bad
|
||||
<Foo onClick={(ev) => {doStuff();}}> // Equally bad
|
||||
<Foo onClick={this.doStuff}> // Better
|
||||
<Foo onClick={this.onClick}> // Best
|
||||
<Foo onClick={this.onFooClick}> // Best, if onFooClick would do anything other than directly calling doStuff
|
||||
```
|
||||
- Think about whether your component really needs state: are you duplicating
|
||||
information in component state that could be derived from the model?
|
||||
|
Loading…
x
Reference in New Issue
Block a user