每当我尝试在以下函数中将type属性添加到 NextJS 中的<input>标签时,都会出现以下错误。const InputComponent = ({value, prefix, id, placeholder, autoCompleteLabel}: InputComponentProps) => {const [focused, setFocused] = useState(false);l
2021-11-14
我使用 map 函数在页面上渲染了一个组件网格,我只想在单击该组件后渲染其所有详细信息,但只会出现错误提示:Uncaught TypeError: Cannot read properties of undefined (reading 'logo')我是 React 新手,不知道为什么会发生这种情况。如能得到帮助将不胜感激!这是我的代码:Body 组件 - (父组件)import { useSt
2021-11-09
我试图让日期以一种良好的格式呈现。当前呈现如下我试过function getEndDateFromstring(){return itinerary.endDate.split('T').slice(-1)[0]}然后{itinerary.name} from {getStartDateFromstring()} to {getEndDateFromstring()}但它抛出了一个错误未捕获的类型
2021-11-09
我使用 React 库创建了一个网格,我想在用户单击名为“获取产品”的按钮时使用 API 调用填充数据。目前,我的网格没有填充,我在调试时收到此错误:Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'dataState')我不确定为什么。为什么网格没有正确填充,我还能做什么?这是我的代码:i
2021-11-01
我正在使用 MUI v5.0.6,当我尝试使用按钮组件时,它一直显示此错误消息,我尝试安装较低版本 v5.0.5,但它显示了同样的问题,不知道是什么原因导致的,我还删除了node_module文件夹并再次安装软件包,但没有解决问题Uncaught TypeError: Cannot read properties of undefined (reading 'button')at webpackH
2021-10-27
我在尝试什么?尝试在状态下设置输入类型文本的值到目前为止我搜索了什么?React - 未捕获的 TypeError:无法读取未定义的属性“setState”但这并不能回答我的问题错误详情TypeError: Cannot read properties of undefined (reading 'setState')在函数 setEmailVal 中设置电子邮件的值时出现此错误组件import
2021-10-23
我有两个组件,我想将数据从其他组件传递给其他组件。我尝试使用此代码,但出现此错误:未捕获 TypeError:无法读取未定义的属性(读取“params”)它正在发送数据,但发送的是空数据。我该如何解决这个问题?front.layout.jsimport Profile from '../../Views/profile'const [user, setUser] = useState({});re
2021-10-18
尝试学习 React/RoR,在这个简单的测试应用中,我有一个“searchapp”反应应用。它为语言单选框设置了默认值。import React from 'react'import ReactDOM from 'react-dom'import axios from "axios";import SearchForm from "./searchForm";class SearchApp ex
我尝试从 commerceJS API 访问从不同模块获取并作为 prop 传递的数据,只有当我调用嵌套产品对象时,代码才会中断,并出现此错误Uncaught TypeError: Cannot read properties of undefined (reading 'source')。我在店面上使用了相同的 API,{product.media.source运行正常。我正在尝试制作一个预览模
2021-09-21
Uncaught TypeError: Cannot read properties of undefined (reading 'length')Error is showing in react-dom-development.js file[1]: https://i.sstatic.net/6a8tF.png[2]: https://i.sstatic.net/Cn3EP.png每当我从子
2021-09-15
我收到错误expect(jest.fn()).toHaveBeenCalledWith(...expected)调用次数:0。代码:There is a component on submitting * as form value it will call formik on submit which willcall api asyncronouslyand storing data in
2021-09-05
我尝试使用从 api 调用中获得的一些详细信息来呈现页面。useEffect(() =>{getCards();}, [])const [userCards, setCards] = useState([])const getCards = async (event) => {let token = localStorage.getItem("user");await api.get("/fetc
2021-08-31
我一直有这个错误:Uncaught TypeError: Cannot read property 'map' of undefined我正在使用 useEffect 从 firestore 检索数据const [users, setUsers] = useState();useEffect(() => {const unsubscribe = firestore.collection("user
2021-08-20
我们尝试从我们自己实施的 CMP 切换到 usercentric。因此,我们通过 gtm 在我们的页面上集成了 usercentric。我意识到该元素仅显示在我们的子页面上,在我们的根页面上不可见。经过两天的移除和再次添加组件。我发现当我从组件中删除id={"process">时,usercentric 能够加载。我多次在我们的页面上使用id标签来执行 smoothscroll 插件。但是,只有应
2021-08-13
我又遇到了一个无法解决的问题!我收到了这个错误,但我不太明白。打开 DOM 并阅读整个错误,并在 Google 上花费了大量时间后,我得到的唯一信息是,错误似乎是由这行代码触发的:const [user, setUser] = useState(null)这是此行所在的代码:import React, { useState, useEffect } from 'react';import { St
2021-08-13