我有两个async函数可以连接到 API 端点(无服务器框架) - 一个获取并返回令牌,另一个使用令牌获取并返回数据。我使用简单的按钮测试这些函数,其中onClick分别调用函数来提取令牌和数据。单击一个按钮获取令牌,该令牌将保存到状态。然后,一旦我看到已收到令牌,我就会单击另一个按钮来获取数据。这完全没有任何问题。问题是当我尝试从 React 应用程序按顺序调用它们时。当用户提交请求时,我需要连
2022-03-14
我想让用户能够从提示中输入多个选项,但我无法做到无论输入“rcz”时是否带大写字母,我总是得到相同的错误。我需要我的计数器出现在控制台中,但我得到的却是这个:Uncaught TypeError: Cannot read properties of null (reading 'toLowerCase')我正在使用的代码:alert(`Choose one or more cars. If you
2022-03-13
const container = document.querySelector("#container");request.open("GET","https://datausa.io/api/data?drilldowns=Nation&measures=Population") ;request.send();// to get the responserequest.addEventLis
2022-03-13
我现在在我的 React Web 应用上遇到了这个问题。我尝试从我创建的 Laravel API 映射学生数据。突然,Web 应用向我显示此错误Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'map')以下是我的代码state = {students: [],loading: true,}
2022-03-12
我使用以下方法存储对图像项的引用:const renderImageRef = useRef()。然后使用以下方法在render()函数中分配引用:<img ref={renderedImageRef} src=... />在下面的另一个 JSX 项中,我尝试使用以下方法访问renderedImageRef.current.clientHeight:<div style={{top:`${rend
2022-03-12
这是我项目中我的组件之一,名为posts.jsx它显示了从组件中收到的所有帖子,但是一旦我渲染组件,页面就会空白:086367698即使我写帖子?地图...它不起作用。请帮助我。708629871
2022-03-08
嗨,我正在尝试制作一个仅验证用户名的登录程序,因此当我尝试将用户输入从 html 传递到 javascript 时,它会将其选为 null,有人知道为什么吗?给我这个错误消息:Login2.js:12Uncaught TypeError: Cannot read properties of null (reading 'value')at HTMLButtonElement.document.ge
2022-03-08
let [item, setItem] = useState({});let [comments, setComments] = useState([]);useEffect(async () => {await axios.all([axios.get(`https://dummyapi.io/data/v1/post/${id}`, {headers: { "app-id": process.
2022-03-06
我试图比较两个对象。如果在 savedList 中也发现了 checkedList 中的项目,我想从 checkedList 复制数组中的第一个项目,并将其与 savedList 中找到的项目放在一起。如果在 savedList 中找不到 checkedList 中的项目,我想将整个项目添加到 savedList。我不希望在 savedList 中两次保留相同的项目。我正在使用 pop/push
2022-03-05
我正在使用 react typescript。当我在 swiper 滑块组件上设置thumbs={{ swiper: thumbsSwiper }>时,它给出了一个错误Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'addClass')。我该如何解决它?如果我在 js 文件中使用以下代码,
2022-03-03
我正在尝试在React中创建一个通过TMDB API进行搜索的搜索栏,但我遇到了一些问题。每当我输入搜索栏时,我都会出现一个错误,说无法读取null的属性(读取'value'),我不确定问题可能是什么以及为什么它以null为单位。我在941614447中调用提及。
2022-03-02
我通过构建锻炼跟踪器来练习我的 MERN 技能,然后我遇到了这个错误:“未捕获的类型错误:无法读取未定义的属性(读取‘params’)”。我最近找到了一个解决方案,指导我使用“useParams”钩子。但这对我来说没用,因为我正在使用类组件。以下是造成问题的代码块:import DatePicker from "react-datepicker";import "react-datepicker/
通过cartitem访问cart中的数据时出现错误。我不太擅长这个。有人能帮我纠正错误吗?import React from 'react'import { Typography, Button, Card, CardActions, CardContent, CardMedia } from '@material-ui/core';import useStyles from './styles'
2022-02-26
class IBSProgressExtension extends Autodesk.Viewing.Extension{constructor(viewer, options) {super(viewer, options);}load() {//For proof of concept project, I will simply store the externalIds here in
2022-02-25
我尝试将 2 个数组合并为一个新数组,该新数组将组合每个数组的对象。我知道如何将 2 个数组合并为 1 个大数组,但我无法将实际对象合并为该数组内的新对象。下面列出了我尝试获取的输入和预期输出的示例:给定数组:array1 = ['1','2','3'];array2 = ['a','b','c'];新输出的数组应为:array3 = ['1a','2b','3c'];这是我迄今为止尝试做的事情。
2022-02-22