我有以下函数,它以React.useRef()作为参数。
在测试它时遇到问题,我试图让useRef保存值并能够removeChild()。
当我运行测试时,我会得到以下错误。
TypeError: useRef.current.removeChild不是一个函数
这是因为在测试期间,我传递的是一个对象而不是一个useRef钩子函数。
如何传入模拟的useRef并能够在测试期间传递值和执行removeChild操作?
这就是实现。
export const postData = (
useRef, // this useRef is coming from the calling com
这是我Drupal网站上的json:
[
{
title: "I believe every human has a finite number of heartbeats. I don't intend to waste any of mine.",
uid: "gestor"
},
{
title: "Man must explore, and this is exploration at its greatest",
uid: "
I我正在尝试从firestore云中获取数据,但得到错误"TypeError: Cannot read properties of undefined (reading 'profilePic')“,为什么它说未定义,但它已定义?
import React, {useState, useEffect} from 'react';
import Post from './Post';
import db from '../firebase';
const Feed = ({profilePic, me