javascript TypeError:无法读取未定义的属性(阅读“setExtraStackFrame”)

m1m5dgzv  于 2023-10-14  发布在  Java
关注(0)|答案(2)|浏览(189)

我目前正面临下面提到的问题。尝试了很多改变来修复它,但没有得到一个完美的解决方案。

at setCurrentlyValidatingElement (react-jsx-runtime.development.jss:574:1)
    at checkPropTypes (react-jsx-runtime.development.jss:618:1)
    at validatePropTypes (react-jsx-runtime.development.jss:1072:1)
    at jsxWithValidation (react-jsx-runtime.development.jss:1192:1)
    at jsxWithValidationDynamic (react-jsx-runtime.development.jss:1209:1)
    at MyComponent.render (MyComponent.jss:85:35)
    at Ho (935.js:2:72533)
    at Qo (935.js:2:72332)
    at Hu (935.js:2:113091)
    at Pi (935.js:2:99309) {componentStack: '\n    at MyComponent (http://localhost:800…://localhost:8000/777.js:1:17479)\n    at Suspense'}

MyComponent.jss:85有一个不同的组件从一个模块,这是抛出方法错误,当试图删除组件的错误消失,但组件是需要的。我尝试匹配依赖项的常见版本。它会抛出同样的错误。

import React from 'react'
import { SidePanel } from '@carbon/ibm-products'
import '@carbon/ibm-products/scss/index-without-carbon.scss'

class MyComponent extends React.Component {
  constructor (props) {
    super(props)
    this.state = {
      error: {}
    }
  }
  componentDidMount () {
    this.setState({
      error: ''
    })
    
  }
  render () {
    const { onSubmit, isOpen, onClose } = this.props
    return (
      <div>
        <SidePanel
          className='test'
          onRequestClose={() => onClose()}
          title='Title'
          actions={[
            {
              label: 'ok',
              onClick: () => onSubmit(),
              kind: 'primary'
            },
            {
              label: 'cancel',
              onClick: () => onClose(),
              kind: 'secondary'
            }
          ]}
        >
          Hello INSIDE SIDE
        </SidePanel> 
      </div>
    )
  }
}

MyComponent.displayName = 'MyComponent'

MyComponent.propTypes = {
  isOpen: PropTypes.bool,
  onClose: PropTypes.func,
  onSubmit: PropTypes.func
}
export default MyComponent
cygmwpex

cygmwpex1#

删除下面列出的以前安装的软件包:
1.React

  1. React-Dom
  2. types@react-dom(如果是typescript)
    删除后安装上述软件包的最新版本。问题将得到解决。
1aaf6o9v

1aaf6o9v2#

我也有“无法读取未定义的属性(阅读'setExtraStackFrame')”添加一个键到Map解决了我的问题。这个解决方案是我的目的ahmetcaglayan。这里是他的答案的链接

相关问题