我尝试根据所选的国家/地区填充州/地区。我收到如下所示的错误服务、操作和 Reducer 均正常运行。我收到了来自操作的响应。以下是代码constructor(props) {super(props)this.state = {CompanyName: '',country:'',statez:'',selectedStateList: []}}componentWillMount(){this.
2018-11-13
如何从数组中访问值 exist?我想我没有将数组传递进去?有任何帮助或建议吗?var isExist = this.props.isFavorite(this.props.code);console.log(isExist)我有这个变量 isExist,其中包含来自下面控制台的响应。[]client: [id: "LvR05w9v9xrC3r4V1W8g", exist: true]length:
2018-10-27
我有一个使用 React 导航的附加信息组件:export class AdditionalInfo extends NavigationPureComponent {static navigationOptions = ({ navigation }) => ({headerLeft: <Button icon="close" onPress={() => navigation.goBack(n
2018-09-11
我在 React 酶测试中收到此错误 -TypeError:无法读取未定义的属性“have”以下是我的测试文件:import React from 'react';import ReactDOM from 'react-dom';import { mount } from 'enzyme';import TransactionsTable from './TransactionsTable';im
我正在尝试获取一个对象的长度,但是正在获取此错误消息:uck typeerror:无法读取未定义的<的属性'长度' p>我试图在长度为零时获得长度并获得弹出窗口。我尝试使用this.props.storyboardtargets.lengths.length === 0案例1:数据不可用,因此(!this.props.storyboardtargets)- &gt;未定义的情况2:数据在那里,然后
2018-07-09
TypeError: Cannot read property 'length' of undefined这就是我运行 React 应用时编译器显示的内容。我需要用它做什么?request = (start,end) => {if(this.state.teams.length < 1){axios.get(`${ URL }/teams`).then( response => {this.set
2018-07-09
我想对我使用“create-react-app”包创建的应用程序进行一些基本的单元测试。我相信它已经安装了 Jest。我的应用程序中有一些基本的 redux 代码。我想测试:它呈现主要组件(App.js)而不会崩溃单击以显示下一个项目功能我已经使用“npm install --save-dev digest”和“enzyme-adapter-react-15”安装了 Enzyme。这是我的代码:i
我按照 Enzyme 中.find()的示例和 GitHub 上的enzyme-example-jest示例获取一个基本组件来测试并验证最外层元素className是否存在,我不明白为什么这没有通过:// REACT COMPONENTclass VisitorShortcut extends Component {//all the props & lifecycle hooks hereren
大家好,我正在开发 reactjs 项目,我遇到了一个问题,如果你想帮助我,请提前感谢我将我的数据<StoryMap data={this.state.data} />传递给我的函数,这样我就可以将活动和任务推送到行为和任务“json 格式”中function StoryMap(props) {var acts = [];var taskss = [];for (var i = 0; i < pr
2018-03-21
我有一个电子邮件字段,只有选中复选框时才会显示(布尔值为true)。提交表单时,我只希望复选框被选中时(布尔值为 true)才需要此字段。这是我到目前为止尝试过的:const validationSchema = yup.object().shape({email: yup.string().email().label('Email').when('showEmail', {is: true,th
2018-03-20
我使用 react js 编写了部分代码来开发网站。加载 localhost/events.html 页面时,我发现网页中缺少事件类数据。只有在浏览同一网站的不同页面后,我才能在 events.html 中看到事件类数据。但第一次访问该页面时看不到。以下是在 chrome 开发人员工具中找到的堆栈跟踪。我在其他浏览器上也遇到了同样的问题。Uncaught TypeError: Cannot rea
我在我的React应用中使用Flow v.0.52进行输入,但在正确分配默认 props 方面遇到了问题。News.jsxclass News extends Component {static defaultProps = {postList: {apiData: [], total: '0'},};componentDidMount() {this.props.getPostListData(
出现一个我无法理解的错误。当我按下<button>50x70</button>并按下<button>run</button>时,我收到此错误。我不明白为什么,因为它适用于标准 50x50 板。为什么这行代码会导致错误?neighbors+=board[x+i][y+j].valuehttps://codepen.io/anon/pen/OjoZKXTypeError: Cannot read pr
2017-08-26
我有一个针对 Enzyme/mocha/chai 的简单测试,想让它通过。错误如下: 1) <PostList /> should have a container for holding posts:TypeError: Cannot read property 'length' of undefinedat PostList.render (D:/mydocs/webdev/gitprojs
我有一个 React 组件。假设是 Todoimport React, { Component } from 'react';import injectSheet from 'react-jss';class Todo extends Component {// methods that incl. state manipulationrender() {const { classes } = t