You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: react/README.md
+17Lines changed: 17 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@
12
12
1.[Quotes](#quotes)
13
13
1.[Spacing](#spacing)
14
14
1.[Props](#props)
15
+
1.[Refs](#refs)
15
16
1.[Parentheses](#parentheses)
16
17
1.[Tags](#tags)
17
18
1.[Methods](#methods)
@@ -299,6 +300,22 @@
299
300
))}
300
301
```
301
302
303
+
## Refs
304
+
305
+
- Always use ref callbacks. eslint: [`react/no-string-refs`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md)
306
+
307
+
```jsx
308
+
// bad
309
+
<Foo
310
+
ref="myRef"
311
+
/>
312
+
313
+
// good
314
+
<Foo
315
+
ref={(ref) => this.myRef = ref}
316
+
/>
317
+
```
318
+
302
319
## Parentheses
303
320
304
321
- Wrap JSX tags in parentheses when they span more than one line. eslint: [`react/wrap-multilines`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md)
0 commit comments