在React warning.js中,它给出了一条错误消息,指出问题所在,但堆栈跟踪似乎与问题完全无关,如下例所示。有没有办法得到导致问题的行号或文件?
警告:未知的DOM属性。你的意思是htmlFor?warning @ warning.js?8a56:45warnUnknownProperty @ DOMPropertyOperations.js?930e:68DOMPropertyOperations.createMarkupForProperty @ DOMPropertyOperations.js?930e:115ReactDOMComponent.Mixin._createOpenTagMarkupAndPutListeners @ ReactDOMComponent.js?1302:548ReactDOMComponent.Mixin.mountComponent @ ReactDOMComponent .js?1302:478ReactReconciler.mountComponent @ ReactReconciler.js?6bfa:37obj。(匿名函数)@ backend.js:8386ReactMultiChild.Mixin.mountChildren @ReactMultiChild.js?c87d:241ReactDOMComponent.Mixin._createContentMarkup @ ReactDOMComponent.js?1302: 591ReactDOMComponent.Mixin.mountComponent @ ReactDOMComponent.js?1302:479ReactReconciler.mountComponent @ ReactReconciler.js?6bfa:37obj。(匿名函数)@ backend.js:8386ReactMultiChild.Mixin.mountChildren @ReactMultiChild.js?c87d:241ReactDOMComponent.Mixin._createContentMarkup @ ReactDOMComponent.js?1302:591ReactDOMComponent.Mixin.mountComponent @ ReactDOMComponent.js?1302:479ReactReconciler.mountComponent @ ReactReconciler.js?6bfa:37obj。(匿名函数)@ backend.js:8386ReactMultiChild.Mixin.mountChildren @ReactMultiChild.js?c87d:241ReactDOMComponent.Mixin._createContentMarkup @ ReactDOMComponent.js?1302:591ReactDOMComponent.Mixin.mountComponent @ ReactDOMComponent。 js?1302:479ReactReconciler.mountComponent @ ReactReconciler.js?6bfa:37obj。(匿名函数)@ backend.js:8386ReactMultiChild.Mixin.mountChildren @ReactMultiChild.js?c87d:241ReactDOMComponent.Mixin._createContentMarkup @ ReactDOMComponent.js?1302:591ReactDOMComponent .Mixin.mountComponent @ ReactDOMComponent.js?1302:479ReactReconciler.mountComponent @ ReactReconciler.js?6bfa:37obj。(匿名函数)@backend.js:8386ReactMultiChild.Mixin.mountChildren @ReactMultiChild.js?c87d:241ReactDOMComponent.Mixin._createContentMarkup @ ReactDOMComponent.js?1302:591ReactDOMComponent.Mixin.mountComponent @ ReactDOMComponent.js?1302:479ReactReconciler.mountComponent @ ReactReconciler.js?6bfa:37obj。(匿名函数)@backend.j s:8386ReactCompositeComponentMixin.mountComponent @ ReactCompositeComponent.js?cd59:225wrapper @ ReactPerf.js?ef93:66ReactReconciler.mountComponent @ ReactReconciler.js?6bfa:37obj。(匿名函数)@ backend.js:8386ReactMultiChild.Mixin._mountChildByNameAtIndex @ ReactMultiChild.js ?c87d:474ReactMultiChild.Mixin._updateChildren @ ReactMultiChild.js?c87d:378ReactMultiChild.Mixin.updateChildren @ ReactMultiChild.js?c87d:326ReactDOMComponent.Mixin._updateDOMChildren @ ReactDOMComponent.js?1302:871ReactDOMComponent.Mixin.updateComponent @ ReactDOMComponent.js?1302 :700ReactDOMComponent.Mixin.receiveComponent @ ReactDOMComponent.js?1302:645ReactReconciler.receiveComponent @ ReactReconciler.js?6bfa:87obj。(匿名函数)@ backend.js:8386ReactChildReconciler.updateChildren @ReactChildReconciler.js?ff46:84ReactMultiChild.Mixin._reconcilerUpdateChildren @ ReactMultiChild.js?c87d:216ReactMultiChild.Mixin._updateChildren @ ReactMultiChild.js?c87d:351ReactMultiChild.Mixin.updateChildren @ R eactMultiChild.js?c87d:326ReactDOMComponent.Mixin._updateDOMChildren @ ReactDOMComponent.js?1302:871ReactDOMComponent.Mixin.updateComponent @ ReactDOMComponent.js?1302:700ReactDOMComponent.Mixin.receiveComponent @ ReactDOMComponent.js?1302:645ReactReconciler.receiveComponent @ ReactReconciler.js? 6bfa:87obj。(匿名函数)@ backend.js:8386ReactChildReconciler.updateChildren @ReactChildReconciler.js?ff46:84ReactMultiChild.Mixin._reconcilerUpdateChildren @ ReactMultiChild.js?c87d:216ReactMultiChild.Mixin._updateChildren @ ReactMultiChild.js?c87d:351ReactMultiChild.Mixin .updateChildren @ ReactMultiChild.js?c87d:326ReactDOMComponent.Mixin._updateDOMChildren @ ReactDOMComponent.js?1302:871ReactDOMComponent.Mixin.updateComponent @ ReactDOMComponent.js?1302:700ReactDOMComponent.Mixin.receiveComponent @ ReactDOMComponent.js?1302:645ReactReconciler.receiveComponent @ ReactReconciler .js?6bfa:87obj。(匿名函数)@ backend.js:8386ReactChildReconciler.updateChildren @ ReactChildReconci ler.js?ff46:84ReactMultiChild.Mixin._reconcilerUpdateChildren @ ReactMultiChild.js?c87d:216ReactMultiChild.Mixin._updateChildren @ ReactMultiChild.js?c87d:351ReactMultiChild.Mixin.updateChildren @ ReactMultiChild.js?c87d:326ReactDOMComponent.Mixin._updateDOMChildren @ ReactDOMComponent。 js?1302:871ReactDOMComponent.Mixin.updateComponent @ ReactDOMComponent.js?1302:700ReactDOMComponent.Mixin.receiveComponent @ ReactDOMComponent.js?1302:645ReactReconciler.receiveComponent @ ReactReconciler.js?6bfa:87obj。(匿名函数)@ backend.js:8386ReactCompositeComponentMixin ._updateRenderedComponent @ ReactCompositeComponent.js CD59:??562ReactCompositeComponentMixin._performComponentUpdate @ ReactCompositeComponent.js CD59:544ReactCompositeComponentMixin.updateComponent @ ReactCompositeComponent.js CD59:473wrapper @ ReactPerf.js ef93:66ReactCompositeComponentMixin.receiveComponent @ ReactCompositeComponent.js CD59:405ReactReconciler.receiveComponent @ ReactReconciler.js?6bfa:87obj。(匿名函数荐)@ backend.js:8386ReactCompositeComponentMixin._updateRenderedComponent @ ReactCompositeComponent.js CD59:562ReactCompositeComponentMixin._performComponentUpdate @ ReactCompositeComponent.js CD59:544ReactCompositeComponentMixin.updateComponent @ ReactCompositeComponent.js CD59:473wrapper @ ReactPerf.js ef93:66ReactCompositeComponentMixin.receiveComponent @ ReactCompositeComponent .js?cd59:405ReactReconciler.receiveComponent @ ReactReconciler.js?6bfa:87obj。(匿名函数)@backend.js:8386ReactCompositeComponentMixin._updateRenderedComponent @ ReactCompositeComponent.js?cd59:562ReactCompositeComponentMixin._performComponentUpdate @ ReactCompositeComponent.js?cd59:544ReactCompositeComponentMixin.updateComponent @ ReactCompositeComponent.js?cd59:473wrapper @ ReactPerf.js?ef93:66ReactCompositeComponentMixin.receiveComponent @ ReactCompositeComponent.js?cd59:405ReactReconciler.receiveComponent @ ReactReconciler.js?6bfa:87obj。(匿名函数)@backend.js:8386ReactCompositeCompo nentMixin._updateRenderedComponent @ ReactCompositeComponent.js CD59:??562ReactCompositeComponentMixin._performComponentUpdate @ ReactCompositeComponent.js CD59:544ReactCompositeComponentMixin.updateComponent @ ReactCompositeComponent.js CD59:473wrapper @ ReactPerf.js ef93:66ReactCompositeComponentMixin.receiveComponent @ ReactCompositeComponent.js CD59:405ReactReconciler。 receiveComponent @ ReactReconciler.js?6bfa:87obj。(匿名函数)@ backend.js:8386ReactCompositeComponentMixin._updateRenderedComponent @ ReactCompositeComponent.js?cd59:562ReactCompositeComponentMixin._performComponentUpdate @ ReactCompositeComponent.js?cd59:544ReactCompositeComponentMixin.updateComponent @ ReactCompositeComponent.js?cd59:473wrapper @ ReactPerf.js?ef93:66ReactCompositeComponentMixin.performUpdateIfNecessary @ ReactCompositeComponent.js?cd59:421ReactReconciler.performUpdateIfNecessary @ ReactReconciler.js?6bfa:102obj。(匿名函数)@ backend.js:8386runBatchedUpdates @ ReactUpdates.js?ce09:129 Mixin.perform @Transaction.js?6dff:136Mixin.perform @Transaction.js?6dff:136assign.perform @ ReactUpdates.js?ce09:86flushBatchedUpdates @ ReactUpdates.js?ce09:147wrapper @ ReactPerf.js?ef93:66Mixin.closeAll @ Transaction.js?6dff:202Mixin.perform @Transaction.js?6dff:149ReactDefaultBatchingStrategy.batchedUpdates @ ReactDefaultBatchingStrategy.js?ef70:62batchedUpdates @ ReactUpdates.js?ce09:94ReactEventListener.dispatchEvent @ ReactEventListener.js?2365:204
答案 0 :(得分:2)
警告:未知的DOM属性。你的意思是htmlFor吗?
第一行告诉您需要知道的所有内容:JSX文件中某处使用的是for
,但在JSX中,您必须使用htmlFor
。
示例:
<div>
<label htmlFor="name">Enter your name: </label>
<input type="text" id="name" />
</div>