Skip to content

Commit 9edcdde

Browse files
authored
Merge pull request airbnb#1620 from lasota-piotr/classname-props
[guide] [react] Added anti-pattern example for Props Naming rule, changed className props in examples
2 parents dbdf8ea + 9d3e7e0 commit 9edcdde

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

react/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@
143143
// bad
144144
<MyComponent style="fancy" />
145145
146+
// bad
147+
<MyComponent className="fancy" />
148+
146149
// good
147150
<MyComponent variant="fancy" />
148151
```
@@ -400,15 +403,15 @@
400403
```jsx
401404
// bad
402405
render() {
403-
return <MyComponent className="long body" foo="bar">
406+
return <MyComponent variant="long body" foo="bar">
404407
<MyChild />
405408
</MyComponent>;
406409
}
407410
408411
// good
409412
render() {
410413
return (
411-
<MyComponent className="long body" foo="bar">
414+
<MyComponent variant="long body" foo="bar">
412415
<MyChild />
413416
</MyComponent>
414417
);
@@ -427,10 +430,10 @@
427430

428431
```jsx
429432
// bad
430-
<Foo className="stuff"></Foo>
433+
<Foo variant="stuff"></Foo>
431434
432435
// good
433-
<Foo className="stuff" />
436+
<Foo variant="stuff" />
434437
```
435438

436439
- If your component has multi-line properties, close its tag on a new line. eslint: [`react/jsx-closing-bracket-location`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md)

0 commit comments

Comments
 (0)