我的代码中有一些警告,但是我找不到这些警告发生的位置。我如何找到警告的位置?
这是我在控制台的警告
react_devtools_backend.js:2655 Warning: validateDOMNesting(...): <table> cannot appear as a descendant of <p>.
at table
at http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
at Table (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:97587:79)
at div
at http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
at Paper (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:84171:79)
at http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
at TableContainer (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:95943:79)
at InnerThemeProvider (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:108555:67)
at ThemeProvider (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:107463:5)
at ThemeProvider (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:108575:5)
at BasicTable (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:132450:20)
at p
at http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
at Typography (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:101212:84)
at div
at http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
at Box (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:110064:69)
at div
at TabPanel (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:132631:24)
at div
at div
at div
at SwipeableViews (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:211683:34)
at div
at http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:1131:66
at Box (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:110064:69)
at InnerThemeProvider (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:108555:67)
at ThemeProvider (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:107463:5)
at ThemeProvider (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:108575:5)
at ProductMetaReview (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:132677:19)
at div
at div
at ProductSingleDetails (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:132920:20)
at div
at Container (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:134071:23)
at ProductPage (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:137283:24)
at main
at div
at Layout (http://dev.etma.site/_next/static/chunks/pages/products/%5BproductSlug%5D/%5Bslug%5D.js?ts=1680587655234:131448:23)
at UIProvider (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:12728:72)
at CartProvider (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:12113:99)
at ManagedUIContext (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:12912:23)
at Hydrate (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:67267:23)
at QueryClientProvider (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:67342:21)
at PresenceChild (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:18809:23)
at AnimatePresence (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:18970:23)
at CustomApp (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:13178:25)
at I18nextProvider (http://dev.etma.site/_next/static/chunks/pages/_app.js?ts=1680587655234:54335:19)
at AppWithTranslation
at ErrorBoundary (http://dev.etma.site/_next/static/chunks/main.js?ts=1680587655234:725:47)
at ReactDevOverlay (http://dev.etma.site/_next/static/chunks/main.js?ts=1680587655234:841:23)
at Container (http://dev.etma.site/_next/static/chunks/main.js?ts=1680587655234:8855:5)
at AppContainer (http://dev.etma.site/_next/static/chunks/main.js?ts=1680587655234:9351:24)
at Root (http://dev.etma.site/_next/static/chunks/main.js?ts=1680587655234:9490:25)
2条答案
按热度按时间gojuced71#
你可以搜索这些字符串,找到代码库中第一次出现“table”和“p”一起使用的警告的地方。这可以帮助你确定问题所在的代码行。
另一种方法是通过保留某些代码段未注解并测试警告是否消失来隔离问题。这可以帮助您识别有问题的代码并解决问题。
x6h2sr282#
检查包含
<table>
元素的products
文件夹下的所有组件。您是否在
<p>
中使用<table>
?