mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-25 02:53:53 +03:00
feat(react-json-tree): Add keyPath to getItemString (#694)
This commit is contained in:
parent
a46b43209d
commit
85b4b0fb04
|
@ -102,14 +102,14 @@ You can pass `getItemString` to customize the way arrays, objects, and iterable
|
|||
By default, it'll be:
|
||||
|
||||
```jsx
|
||||
<JSONTree getItemString={(type, data, itemType, itemString)
|
||||
<JSONTree getItemString={(type, data, itemType, itemString, keyPath)
|
||||
=> <span>{itemType} {itemString}</span>}
|
||||
```
|
||||
|
||||
But if you pass the following:
|
||||
|
||||
```jsx
|
||||
const getItemString = (type, data, itemType, itemString)
|
||||
const getItemString = (type, data, itemType, itemString, keyPath)
|
||||
=> (<span> // {type}</span>);
|
||||
```
|
||||
|
||||
|
|
|
@ -193,7 +193,8 @@ export default class JSONNestedNode extends React.Component<Props, State> {
|
|||
nodeType,
|
||||
data,
|
||||
itemType,
|
||||
createItemString(data, collectionLimit)
|
||||
createItemString(data, collectionLimit),
|
||||
keyPath
|
||||
);
|
||||
const stylingArgs = [keyPath, nodeType, expanded, expandable] as const;
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ interface JSONNestedNodeCircularPropsPassedThroughJSONTree {
|
|||
nodeType: string,
|
||||
data: any,
|
||||
itemType: React.ReactNode,
|
||||
itemString: string
|
||||
itemString: string,
|
||||
keyPath: (string | number)[]
|
||||
) => React.ReactNode;
|
||||
postprocessValue: (value: any) => any;
|
||||
isCustomNode: (value: any) => boolean;
|
||||
|
|
Loading…
Reference in New Issue
Block a user