开发者问题收集
在用户尝试更改密码之前,我尝试再次确认用户密码。目前,我的 Firebase Auth 项目已在 Firebase.js 中配置并正确导出//appConfig = ...(all the configurations here)const app = firebase.initializeApp(appConfig);const projectAuth = app.auth()export {
我想在onChange事件上更新问题名称。但问题是,如果我只更改一个问题,则每个问题都会更改。如何解决?class QuestionCreate extends React.Component {constructor(props){super(props);this.state = {datas: [],default_question: {isNew: true,question: {name
我有一个对象数组const array = [{ itemId: "optionOne", name: "Option One", quantity: 10 },{ itemId: "optionTwo", name: "Option Two", quantity: 20 },{ itemId: "optionThree", name: "Option Three", quantity: 30 }
我尝试根据数据数组中的 id 更新特定值。我尝试在 redux 中的 Reducer 中执行此操作。例如,我需要的是这样的 case STATION_SELECT:const checkedGroupData = (data,id) => {console.log(data);console.log(id);}return {...state,chargingStationG
我的对象数组中有一个booksOwned,我想将另一本书添加到“John Doe”的 booksOwned 中。const [ownerInfo, setOwnerInfo] = React.useState([{owner: "John Doe",booksOwned: ["To Kill a Mockingbird", "1984"],},{owner: "John Doe Jr",books
我试图更新对象数组内的对象中的特定值。示例:[{id: 1,service: 1001,country: {id: 1,countryname: India},ts: 1597758281},{id: 2,service: 1002,country: {id: 2,countryname: USA},ts: 1597758283}]现在,我想更新第一个对象的 country id 值,因此它会变成
我有一个状态(对象数组),如下所示: const [state,setstate]=useState({picture:'',name:'',job:''})我在前端有 3 个输入,分别是图片、姓名、工作...我定义一个数组来保存对象集合(包括每个人的图片、姓名和工作),如下所示: var colllection=[]我使用 collection.push({state}) ,但它会覆盖集合,并且
const [data , setData] = useState([{id:1,name : "Walnuts",checked:false},{id:2,name:"cashew nut",checked : false,},{id:3,name:"pista",checked : false,},{id:4,name : "almond",checked:false},{id:5,name:
我目前有一个对象数组。每个对象数组包含一个已选中的键和一个布尔类型的值。我试图在用户选择某个复选框时循环遍历该数组,并将该对象的已选中值更新为 true 或 false。我遇到的问题是将更新后的对象散布回数组中而不创建重复项。我的代码如下:import { useState } from "react";import "./styles.css";export default function A
状态:const [tiles, setTiles] = useState(tilesData)状态内的数据:(tilesData)const defaultValueCard = {name: 'Bahamut',cardValues: { N: 0, E: 0, S: 0, W: 0 },image: 'URL'}export const tilesData =[{ tileNumber: 1
我使用的是 React 的较新版本,并尝试更改数组中对象的状态。目前,我将对象从数组中拉出,更改该对象中的属性,然后再次将新对象添加到状态中。问题是它将对象发送到列表的后面并重新排序我的复选框输入。 const handleChange = (e) => {if (e.target.type === "checkbox") {// Get the role from the current st
我尝试将 react-redux 与 typescript 结合使用,当我尝试使用 connect() 和 mapStateToProps 注入 props 时,出现了类型错误。我的组件如下所示:function mapStateToProps(state) {return {counter: state.counter};}function mapDispatchToProps(dispatch
快速提问,我正在用 typescript 和 redux 编写一个 React-native 应用程序。尝试 connect() 时遇到错误,似乎找不到错误的解决方案。我假设是我做错了什么,但看了几个小时后还是找不到原因。错误:Argument of type '(state: AppStateType) => { user: AppStateType; }' is not assignable
我对 Typescript 还比较陌生,目前正在构建一个包含 Redux 并使用 Typescript 的 React 应用。Typescript 在我的 Reducer 中给了我以下错误;ERROR in /Users/<REDACTED>/web/src/redux/reducers/steppedViews.ts./src/redux/reducers/steppedViews.ts[tsl
我正在使用 jumbo 4.1.1 模板。我得到了响应,但出现了此错误。我的代码如下:authAction.js:...export const userSignIn = (user) => {// const {email, password} = user;console.log(user)axios.post(base_url +'login', user).then(response=>