Skip to content

Commit

Permalink
Change the 'idKey' parameter's default value (#30502)
Browse files Browse the repository at this point in the history
I think it is easier for beginners to use the function, because the default value for the id key is 'id', not 'key'
  • Loading branch information
AcademicHumber committed Apr 19, 2021
1 parent ace4336 commit 83f140e
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -163,7 +163,7 @@ To do this, we can use a function like the following:
```javascript
const flatListToHierarchical = (
data = [],
{ idKey = "key", parentKey = "parentId", childrenKey = "children" } = {}
{ idKey = "id", parentKey = "parentId", childrenKey = "children" } = {}
) => {
const tree = []
const childrenOf = {}
Expand Down

0 comments on commit 83f140e

Please sign in to comment.