File tree Expand file tree Collapse file tree 12 files changed +56
-33
lines changed
Expand file tree Collapse file tree 12 files changed +56
-33
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "bracketSpacing": false,
3+ "jsxBracketSameLine": true,
4+ "parser": "flow",
5+ "printWidth": 40,
6+ "singleQuote": true,
7+ "trailingComma": "es5"
8+ }
Original file line number Diff line number Diff line change @@ -14,5 +14,5 @@ function App() {
1414
1515ReactDOM . render (
1616 < App /> ,
17- document . getElementById ( 'root' ) ,
17+ document . getElementById ( 'root' )
1818) ;
Original file line number Diff line number Diff line change @@ -39,7 +39,8 @@ function Comment(props) {
3939
4040const comment = {
4141 date : new Date ( ) ,
42- text : 'I hope you enjoy learning React!' ,
42+ text :
43+ 'I hope you enjoy learning React!' ,
4344 author : {
4445 name : 'Hello Kitty' ,
4546 avatarUrl :
@@ -52,5 +53,5 @@ ReactDOM.render(
5253 text = { comment . text }
5354 author = { comment . author }
5455 /> ,
55- document . getElementById ( 'root' ) ,
56+ document . getElementById ( 'root' )
5657) ;
Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ function Comment(props) {
2727
2828const comment = {
2929 date : new Date ( ) ,
30- text : 'I hope you enjoy learning React!' ,
30+ text :
31+ 'I hope you enjoy learning React!' ,
3132 author : {
3233 name : 'Hello Kitty' ,
3334 avatarUrl :
@@ -40,5 +41,5 @@ ReactDOM.render(
4041 text = { comment . text }
4142 author = { comment . author }
4243 /> ,
43- document . getElementById ( 'root' ) ,
44+ document . getElementById ( 'root' )
4445) ;
Original file line number Diff line number Diff line change @@ -5,5 +5,5 @@ function Welcome(props) {
55const element = < Welcome name = "Sara" /> ;
66ReactDOM . render (
77 element ,
8- document . getElementById ( 'root' ) ,
8+ document . getElementById ( 'root' )
99) ;
Original file line number Diff line number Diff line change 11const element = < h1 > Hello, world!</ h1 > ;
22const container = document . getElementById (
3- 'root' ,
3+ 'root'
44) ;
55ReactDOM . render ( element , container ) ;
Original file line number Diff line number Diff line change 11ReactDOM . render (
22 < h1 > Hello, world!</ h1 > ,
3- document . getElementById ( 'root' ) ,
3+ document . getElementById ( 'root' )
44) ;
Original file line number Diff line number Diff line change @@ -15,5 +15,5 @@ const element = (
1515
1616ReactDOM . render (
1717 element ,
18- document . getElementById ( 'root' ) ,
18+ document . getElementById ( 'root' )
1919) ;
Original file line number Diff line number Diff line change @@ -33,8 +33,10 @@ class ToDoList extends React.Component {
3333 sortByEarliest ( ) {
3434 const sortedList = this . state . list . sort (
3535 ( a , b ) => {
36- return a . createdAt - b . createdAt ;
37- } ,
36+ return (
37+ a . createdAt - b . createdAt
38+ ) ;
39+ }
3840 ) ;
3941 this . setState ( {
4042 list : [ ...sortedList ] ,
@@ -44,8 +46,10 @@ class ToDoList extends React.Component {
4446 sortByLatest ( ) {
4547 const sortedList = this . state . list . sort (
4648 ( a , b ) => {
47- return b . createdAt - a . createdAt ;
48- } ,
49+ return (
50+ b . createdAt - a . createdAt
51+ ) ;
52+ }
4953 ) ;
5054 this . setState ( {
5155 list : [ ...sortedList ] ,
@@ -87,25 +91,25 @@ class ToDoList extends React.Component {
8791 < br />
8892 < button
8993 onClick = { this . addToStart . bind (
90- this ,
94+ this
9195 ) } >
9296 Add New to Start
9397 </ button >
9498 < button
9599 onClick = { this . addToEnd . bind (
96- this ,
100+ this
97101 ) } >
98102 Add New to End
99103 </ button >
100104 < button
101105 onClick = { this . sortByEarliest . bind (
102- this ,
106+ this
103107 ) } >
104108 Sort by Earliest
105109 </ button >
106110 < button
107111 onClick = { this . sortByLatest . bind (
108- this ,
112+ this
109113 ) } >
110114 Sort by Latest
111115 </ button >
@@ -117,8 +121,11 @@ class ToDoList extends React.Component {
117121 </ tr >
118122 { this . state . list . map (
119123 ( todo , index ) => (
120- < ToDo key = { index } { ...todo } />
121- ) ,
124+ < ToDo
125+ key = { index }
126+ { ...todo }
127+ />
128+ )
122129 ) }
123130 </ table >
124131 </ div >
@@ -128,5 +135,5 @@ class ToDoList extends React.Component {
128135
129136ReactDOM . render (
130137 < ToDoList /> ,
131- document . getElementById ( 'root' ) ,
138+ document . getElementById ( 'root' )
132139) ;
Original file line number Diff line number Diff line change @@ -33,8 +33,10 @@ class ToDoList extends React.Component {
3333 sortByEarliest ( ) {
3434 const sortedList = this . state . list . sort (
3535 ( a , b ) => {
36- return a . createdAt - b . createdAt ;
37- } ,
36+ return (
37+ a . createdAt - b . createdAt
38+ ) ;
39+ }
3840 ) ;
3941 this . setState ( {
4042 list : [ ...sortedList ] ,
@@ -44,8 +46,10 @@ class ToDoList extends React.Component {
4446 sortByLatest ( ) {
4547 const sortedList = this . state . list . sort (
4648 ( a , b ) => {
47- return b . createdAt - a . createdAt ;
48- } ,
49+ return (
50+ b . createdAt - a . createdAt
51+ ) ;
52+ }
4953 ) ;
5054 this . setState ( {
5155 list : [ ...sortedList ] ,
@@ -87,25 +91,25 @@ class ToDoList extends React.Component {
8791 < br />
8892 < button
8993 onClick = { this . addToStart . bind (
90- this ,
94+ this
9195 ) } >
9296 Add New to Start
9397 </ button >
9498 < button
9599 onClick = { this . addToEnd . bind (
96- this ,
100+ this
97101 ) } >
98102 Add New to End
99103 </ button >
100104 < button
101105 onClick = { this . sortByEarliest . bind (
102- this ,
106+ this
103107 ) } >
104108 Sort by Earliest
105109 </ button >
106110 < button
107111 onClick = { this . sortByLatest . bind (
108- this ,
112+ this
109113 ) } >
110114 Sort by Latest
111115 </ button >
@@ -121,7 +125,7 @@ class ToDoList extends React.Component {
121125 key = { todo . id }
122126 { ...todo }
123127 />
124- ) ,
128+ )
125129 ) }
126130 </ table >
127131 </ div >
@@ -131,5 +135,5 @@ class ToDoList extends React.Component {
131135
132136ReactDOM . render (
133137 < ToDoList /> ,
134- document . getElementById ( 'root' ) ,
138+ document . getElementById ( 'root' )
135139) ;
You can’t perform that action at this time.
0 commit comments