我有以下函数,它以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: "
我的反应很新,现在我正在尝试使用故事簿。当我使用npm run storybook时,会遇到下面的错误。我已经试过想办法了,但我还是不确定。
无法读取未定义(读取“类型”)TypeError的属性:无法读取未定义的属性(读取“类型”)
at isMdx (http://localhost:6006/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_lib_runtime_RefreshUtils_js-node_mod-3a4695.iframe.bundle.js:3504:30)
at mdxToJsx (http://loc
你能帮我解决这个问题吗?
TypeError:由于“this.props.Name”的属性“id”未定义,无法对其进行析构。
src/component/Detail.js文件
import React, { Component } from 'react';
import { Character } from './Data_Character/Character';
import Total from './Total';
export default class Detail extends Component {
co