-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(TableExampleSortable): your description #3964
Conversation
Updated for react hooks
💖 Thanks for opening this pull request! 💖 Here is a list of things that will help get it across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
} | ||
|
||
export default Table; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export default Table; |
function Table() { | ||
const [column, updateColumn] = useState(null); | ||
const [data, updateData] = useState(tableData); | ||
const [direction, updateDirection] = useState(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that useRedurer
will be a better solution in this case. Can we use it?
|
||
handleSort = (clickedColumn) => () => { | ||
const { column, data, direction } = this.state | ||
function Table() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function Table() { | |
export default TableExampleSortable() { |
- default export works for functions 😸
- let's keep existing example name
{ name: 'Leslie', age: 25, gender: 'Other' }, | ||
{ name: 'Ben', age: 70, gender: 'Male' }, | ||
] | ||
{ name: "John", age: 15, gender: "Male" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks that you have a different formatting there. Please run yarn prettier:fix
& yarn lint:fix
it should fix your issues and pass build.
@@ -1,62 +1,51 @@ | |||
import _ from 'lodash' | |||
import React, { Component } from 'react' | |||
import { Table } from 'semantic-ui-react' | |||
import React, { useState } from "react"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import React, { useState } from "react"; | |
import React from "react"; |
I suggest to use React.useState
/React.useReducer
as it gives more context from where hooks came.
Codecov Report
@@ Coverage Diff @@
## master #3964 +/- ##
==========================================
- Coverage 99.84% 99.84% -0.01%
==========================================
Files 184 183 -1
Lines 3220 3157 -63
==========================================
- Hits 3215 3152 -63
Misses 5 5
Continue to review full report at Codecov.
|
Updated for react hooks