react-json-view-lite
Advanced tools
Comparing version
@@ -0,1 +1,7 @@ | ||
## 1.2.1 | ||
### Bug Fixes | ||
- [Fixed](https://github.com/AnyRoad/react-json-view-lite/issues/20) component didn't work with React 16 and React 17 | ||
## 1.2.0 | ||
@@ -2,0 +8,0 @@ |
export declare function useBool(initialValueCreator: () => boolean): [boolean, () => void, (value: boolean) => void]; | ||
export declare function useComponentId(): string; |
@@ -30,2 +30,11 @@ var React = require('react'); | ||
} | ||
let componentId = 1; | ||
const generateNextId = () => componentId++; | ||
function useComponentId() { | ||
const componentId = React.useRef(); | ||
if (componentId.current === undefined) { | ||
componentId.current = `:jsnvw:${generateNextId()}:`; | ||
} | ||
return componentId.current; | ||
} | ||
@@ -55,3 +64,3 @@ function ExpandableObject(_ref) { | ||
const ariaLabel = expanded ? 'collapse JSON' : 'expand JSON'; | ||
const contentsId = React.useId(); | ||
const contentsId = useComponentId(); | ||
const childLevel = level + 1; | ||
@@ -58,0 +67,0 @@ const lastIndex = data.length - 1; |
@@ -1,2 +0,2 @@ | ||
import { useState, createElement, useRef, useEffect, useId } from 'react'; | ||
import { useState, useRef, createElement, useEffect } from 'react'; | ||
@@ -30,2 +30,11 @@ const isBoolean = data => { | ||
} | ||
let componentId = 1; | ||
const generateNextId = () => componentId++; | ||
function useComponentId() { | ||
const componentId = useRef(); | ||
if (componentId.current === undefined) { | ||
componentId.current = `:jsnvw:${generateNextId()}:`; | ||
} | ||
return componentId.current; | ||
} | ||
@@ -55,3 +64,3 @@ function ExpandableObject(_ref) { | ||
const ariaLabel = expanded ? 'collapse JSON' : 'expand JSON'; | ||
const contentsId = useId(); | ||
const contentsId = useComponentId(); | ||
const childLevel = level + 1; | ||
@@ -58,0 +67,0 @@ const lastIndex = data.length - 1; |
{ | ||
"name": "react-json-view-lite", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "JSON viewer component for React focused on performance for large volume input while still providing few customiziation features", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/AnyRoad/react-json-view-lite", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
77984
2.55%713
2.74%