开发者问题收集
我正在尝试使用 axios 将数据发布到我的 API。我需要请求并随请求发送 XSFR 令牌。我正在使用 React、Redux、Thunk 和 Axios。我需要将其作为 React 组件本身内的承诺来处理。现在是这样,但它没有以期望的方式响应。只要令牌请求成功,它总是会解决承诺,即使发布失败。我在 React 组件中启动它的调用位于底部,即使 axios 调用在发布时失败,它也会给我是,并且我
AxiosConfig.jsimport axios from "axios";import { store } from "./redux/store";import { login, logout } from "./redux/slices/user";const baseURL = process.env.NEXT_PUBLIC_API_URL;axios.defaults.baseURL
尝试从 API 获取数据时控制台中出现该错误。有人遇到过这个问题吗?import React,{useState,useEffect} from 'react'import "../App.css"import axios from "axios"const Main = () => {const [loading,setLoading] = useState(false)const [data,
我使用 ASP.NET 创建了一个 API,并且我有一个运行 React 的网站。我想使用 Axios 显示从 API 到 React 的获取请求检索的数据。该网站有一种使用两个 cookie 的身份验证方法。我可以让 Axios 从https://jsonplaceholder.typicode.com/users获取数据,但是当我使用相同的代码时,我收到错误:Uncaught (in prom
我在 vs code 终端上使用“npm i @fortawesome/react-fontawesome”下载了 fontawesome 图标然后下载了其他免费的 solid 和品牌 svg 图标,例如“npm i @fortawesome/free-brands-svg-icons”;“npm i @fortawesome/free-solid-svg-icons”。然后,当我用这个图标编写代
Warning: A component is changing an uncontrolled input of type text to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlle
我收到此错误:Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.这是我的代码:var React = requi
我正在尝试使用 typescript 为 electron 和 react 创建汇总设置。我收到一个引用错误,因为process未在 /node_modules/react/index.js 中定义。我创建了以下配置文件:从 '@rollup/plugin-commonjs' 导入 commonjs从 'rollup-plugin-copy' 导入 copy从 '@rollup/plugin-ty
我开始在另一个项目中使用 storybook,我之前在另一个 repo 中已经让 SCSS @import 工作了,但我无论如何也想不出哪里出了问题。ERROR in ./src/components/Navigation/style.scss(./node_modules/react-scripts/node_modules/css-loader/dist/cjs.js??ref--8-1!./
尝试使用 redux-toolkit rtk 查询运行第一个测试并收到 api 未定义的错误。我做错了什么? ● Test suite failed to runTypeError: Cannot read property 'injectEndpoints' of undefined33 | };34 |> 35 | export const authApi = api.injectEndpo
我的问题将基于此示例:https://codesandbox.io/s/github/reduxjs/redux-toolkit/tree/master/examples/query/react/authentication-with-extrareducers?from-embed=&file=/src/app/services/auth.ts不知道如何使用useSelector访问从 RTK
我曾将 redux persist 与 RTK 查询和 redux 工具包一起使用。在从浏览器设置中手动清除浏览器数据后,它无法重新水化 RTK 查询减速器并显示Uncaught TypeError: Cannot read properties of undefined (reading 'notesApi')at Object.extractRehydrationInfo (notesApi.
我是 RTK 查询的新手,我目前正在观看一个教程,其中使用 ExtraReducers 将 RTK 查询数据存储在 redux 切片中。我试图将 RTK 查询数据存储在切片状态中,但无法做到。import { createSlice } from "@reduxjs/toolkit";import apiService from "../Services/serviceFeature";const
在 DidMount 上的 MainComponent 类中,我正在运行以下命令: getResultsSearchURL = () => {if (this.props.tokenized && this.props.match.params.searchQuery) {console.log("tokenized");this.props.dispatch(getResult({key: t
因此,我正在按照本教程操作,但接下来的步骤却让我很为难。Redux 被引入了,但它不起作用。我在 Google 上搜索了我在开发者工具中发现的错误,尝试了许多建议的解决方案,但仍然无法修复该错误。错误位于 HomeScreen 的第 25 行 (products.map) 我的代码:HomeScreen.js:import React, {useState, useEffect} from 're