Skip to content

Commit

Permalink
React: Remove npm dependency for Warning package
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjbradshaw committed Aug 30, 2024
1 parent 32130be commit e4e731c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/react/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import connectResizer from '@iframe-resizer/core'
import React, { useEffect, useImperativeHandle, useRef } from 'react'
import warning from 'warning'

import filterIframeAttribs from '../common/filter-iframe-attribs'

Expand All @@ -12,10 +11,12 @@ function IframeResizer(props) {
const iframeRef = useRef(null)

const onClose = () => {
warning(
!iframeRef.current,
`[iframe-resizer/react][${iframeRef?.current?.id}] Close event ignored, to remove the iframe update your React component.`,
)
if (!iframeRef.current)
// eslint-disable-next-line no-console
console.warn(
`[iframe-resizer/react][${iframeRef?.current?.id}] Close event ignored, to remove the iframe update your React component.`,
)

return !iframeRef.current // Allow React to close this
}

Expand Down

0 comments on commit e4e731c

Please sign in to comment.