fix: use JavaScript default parameters instead React's defaultProps (#9453)

This commit is contained in:
Joon Kyoung
2024-01-04 22:32:21 +09:00
committed by GitHub
parent f7bd96f453
commit d5a51463ff
16 changed files with 15 additions and 95 deletions

View File

@@ -7,7 +7,7 @@ import isFunction from "lodash/isFunction"
import saveAs from "js-file-download"
import { CopyToClipboard } from "react-copy-to-clipboard"
const HighlightCode = ({value, fileName, className, downloadable, getConfigs, canCopy, language}) => {
const HighlightCode = ({value, fileName = "response.txt", className, downloadable, getConfigs, canCopy, language}) => {
const config = isFunction(getConfigs) ? getConfigs() : null
const canSyntaxHighlight = get(config, "syntaxHighlight") !== false && get(config, "syntaxHighlight.activated", true)
const rootRef = useRef(null)
@@ -82,8 +82,4 @@ HighlightCode.propTypes = {
canCopy: PropTypes.bool
}
HighlightCode.defaultProps = {
fileName: "response.txt"
}
export default HighlightCode