gpt4 book ai didi

react-redux - TypeError:react__WEBPACK_IMPORTED_MODULE_5 ___ default.a.PropTypes未定义

转载 作者:行者123 更新时间:2023-12-02 02:49:59 26 4
gpt4 key购买 nike

我收到“TypeError:react__WEBPACK_IMPORTED_MODULE_5 ___ default.a.PropTypes undefined ”。我只是一个初学者。我无法想出什么问题了。

这是代码:

import React from 'react';

class App extends React.Component {
render(){
let txt = this.props.txt
return (
<div>
<h1>{txt}</h1>
</div>

)
}
}

App.propTypes = {
txt: React.PropTypes.string,
cat: React.PropTypes.number.isRequired
}

export default App

最佳答案

新手也在这里。我认为在您的特定情况下,您需要:

import ReactDOM from 'react-dom';

我一直在努力解决类似的问题,但是使用react-bootstrap,尽管我的具体错误是:
TypeError: react_bootstrap_lib__WEBPACK_IMPORTED_MODULE_7___default.a is undefined 

我在想我的问题可能与缺少依赖项有关,但不能完全确定我缺少还是没有导入。

这是完整的控制台输出,希望有人能看到并知道 react-bootstrap 1.0 beta和我需要导入的内容:
The development server has disconnected.
Refresh the page if necessary. 0.chunk.js:24766:5
The above error occurred in the <Example> component:
in Example (at src/index.js:35)

TypeError: react_bootstrap_lib__WEBPACK_IMPORTED_MODULE_7___default.a is undefined
main.chunk.js:54:1
render
http://localhost:3000/static/js/main.chunk.js:54:1
finishClassComponent
http://localhost:3000/static/js/0.chunk.js:39068:26
updateClassComponent
http://localhost:3000/static/js/0.chunk.js:39032:14
beginWork
http://localhost:3000/static/js/0.chunk.js:39650:20
performUnitOfWork
http://localhost:3000/static/js/0.chunk.js:42205:16
workLoop
http://localhost:3000/static/js/0.chunk.js:42244:28
callCallback
http://localhost:3000/static/js/0.chunk.js:25107:13
invokeGuardedCallbackDev
http://localhost:3000/static/js/0.chunk.js:25156:11
invokeGuardedCallback
http://localhost:3000/static/js/0.chunk.js:25206:7
replayUnitOfWork
http://localhost:3000/static/js/0.chunk.js:41499:9
renderRoot
http://localhost:3000/static/js/0.chunk.js:42337:15
performWorkOnRoot
http://localhost:3000/static/js/0.chunk.js:43215:11
performWork
http://localhost:3000/static/js/0.chunk.js:43122:11
performSyncWork
http://localhost:3000/static/js/0.chunk.js:43095:7
requestWork
http://localhost:3000/static/js/0.chunk.js:42972:9
scheduleWork
http://localhost:3000/static/js/0.chunk.js:42765:9
scheduleRootUpdate
http://localhost:3000/static/js/0.chunk.js:43486:7
updateContainerAtExpirationTime
http://localhost:3000/static/js/0.chunk.js:43512:14
updateContainer
http://localhost:3000/static/js/0.chunk.js:43543:14
./node_modules/react-dom/cjs/react-dom.development.js/ReactRoot.prototype.render
http://localhost:3000/static/js/0.chunk.js:43825:7
legacyRenderSubtreeIntoContainer/<
http://localhost:3000/static/js/0.chunk.js:43979:13
unbatchedUpdates
http://localhost:3000/static/js/0.chunk.js:43360:14
legacyRenderSubtreeIntoContainer
http://localhost:3000/static/js/0.chunk.js:43975:9
render
http://localhost:3000/static/js/0.chunk.js:44039:16
./src/index.js
http://localhost:3000/static/js/main.chunk.js:133:1
__webpack_require__
http://localhost:3000/static/js/bundle.js:783:12
fn
http://localhost:3000/static/js/bundle.js:151:20
0
http://localhost:3000/static/js/main.chunk.js:151:18
__webpack_require__
http://localhost:3000/static/js/bundle.js:783:12
checkDeferredModules
http://localhost:3000/static/js/bundle.js:46:23
webpackJsonpCallback
http://localhost:3000/static/js/bundle.js:33:19
<anonymous>
http://localhost:3000/static/js/main.chunk.js:1:2

关于react-redux - TypeError:react__WEBPACK_IMPORTED_MODULE_5 ___ default.a.PropTypes未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52694290/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com