开发者问题收集
我尝试以这种方式检索数据:useEffect(() => {async function fetchData() {const response = await fetch('https://hasanadiguzel.com.tr/api/kurgetir');const json = await response.json();setData(json);}fetchData();}, [])
我该如何修复此错误?当我返回屏幕时,它显示此错误,有人知道我该如何修复此问题吗?我从不同的屏幕获取 useremail 和 userVerificationCode,你们都可以看到我的 useremail 和 userVerificationCode 来自哪个函数const ForgetPassword_Verify = ({ navigation, route }) => {const { us
我正在使用多头像 API 在 UI 上渲染随机图像,但出现了以下错误。我也尝试使用承诺来渲染 UI,但未能获得结果。Uncaught TypeError: The first argument must be one of type string,Buffer, ArrayBuffer, Array, or Array-like Object. Received typeundefinedimpo
我制作了一个 React 和 Sanity 项目。但无法通过 Google 进行身份验证。如何通过这种安全方式解决?(而不是使用“口香糖”)我收到以下消息:未捕获的 TypeError:无法解构“response.profileObj”的属性“name”,因为它未定义。这导致我没有得到 profileObj,因此也无法破坏 name 属性...相反,我得到了这个对象:{"error": "idpi
将Next-jsReact复选框列表代码段提取到沙箱后,我遇到了问题。每当我单击复选框时,我都会收到错误:TypeError:无法读取未定义的属性(读取“id”)源自行264:setCheckedThread(prev => new Set(prev.add(pageData.currentThreads[index].id)));但在index.js的顶部,我已定义静态JSON并且在useEff
我想我误解了异步等待的工作方式,尤其是使用另一个文件中的函数时。因此,我想使用 API 上的 axios 调用从经度和纬度获取地址import { getAddressFromLongLat } from "../hooks/queries-hook";import React, { useEffect, useState } from "react";const Component = (pro
收到物品后,出现以下错误。目前我只是在学习,并查看了有关此主题的其他答案,但没有任何结果。export default function App() {const [items, setItems] = React.useState();React.useEffect(() => {axios.get('https://62fa26ddffd7197707e66da8.mockapi.io/ite
我如何更改所提供 ID 的值?我一直收到此 TypeError:无法设置未定义的属性(设置“select”)const data = [{id: 1,select: false},{id: 2,select: true},{id: 3,select: true},{id: 4,select: false},{id: 5,select: false}];const ids = [1, 2, 4];l
const HomeScreen = ({ navigation }) => {const [reviews, setReviews] = useState([{ title: 'Zelda, Breath of Fresh Air', rating: 5, body: 'lorem ipsum', key: '1' },{ title: 'Gotta Catch Them All (again)
当我使用 props 将数据传递给我的组件并尝试从那里访问它时,我收到一个错误。我的数据格式如下export const data = [{id: 0,title: 'Test',price: 1500,},];我导入它并通过 props 传递数据,如下所示:const post0 = data[0];...<Post post={post0}/>在我的组件中,我成功接收了数据,我可以通过类似co
我一直在尝试在 React 中创建一个利用 Swiper.js 自动播放功能来停止和播放的 Swiper。我尽可能地遵循他们的指示,并进行了大量研究以寻找答案。我甚至能够通过执行相同操作的jQuery 示例(某种程度上)确认我的设置,但即使是该参考在 React 中也无济于事。这是我目前得到的结果:// Note: I am using Next.js,// so there are some m
我使用 AWS Amplify 部署 React 应用程序。当我部署 React Web 应用程序时,根 URL 可按预期工作(example.com)。但是,如果您尝试访问子 URL(例如 example.com/something),则会出现错误 AccessDenied。我的 react-router 代码如下:import { BrowserRouter, Routes, Route }
我正尝试使用通过 API 调用检索到的数组中的数据填充对象列表。我确实获得了正确的数据(可以 console.log 该对象),但在代码中使用它不起作用。我尝试了多种解决方案,但到目前为止都没有奏效,我陷入了困境,在花另外 2 天时间之前,我想寻求您的帮助。我相信这是一件我还没有学会的简单的事情。TypeError:无法读取未定义的属性(读取“map”)const EventCarousel =
我有以下代码,我正在尝试显示对象对象的数据。我收到的错误是 TypeError:无法读取未定义的属性。我知道数据不是“对象数组”的格式,但我仍然不知道如何正确映射它。我希望得到一些帮助......import Layout, { siteTitle } from '../components/layout';import { useState, useEffect } from 'react'ex
嗨,我正在尝试映射一个 api 数组以显示数组中每个索引的段落。但是我一直收到错误:**> TypeError:未定义不是对象(正在评估'post.game_indices.version.name')**但是当我控制台日志发布并使用下面的按钮时,它显示我想要的内容而不是未定义。那么为什么当我想映射段落时它是未定义的?'''从'react'导入 React,{useEffect,useState}