在过去的几个小时里,我一直在修复与react-pdf包相关的问题。我已经尝试了网上可用的各种例子。但是我正面临着同样的错误信息。 Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might
代码:
// Import libraries for making a Component
import React from 'react';
import ReactNative from 'react-native';
// Make a Component
const Header = () => {
return <Text>Albums!</Text>;
};
// Make the Component available to other parts of the App
export default H
我在用Jest /酶编写的测试用例中遇到了一些问题。我有一个React / Redux组件,并且试图编写一个基本的测试,但是得到了以下错误:
Invariant Violation: ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was 'undefined'.
这是我的密码:
dashboardComponent.js
import '../stylesheets/dashboardCom
我开始了一个小的反应项目(初学者),当我把我的'App‘组件切割成许多小组件,比如'header',它就不能工作了。我一砍掉头,错误就开始发生了。并且说,标题css也没有加载。您可以在元素检查器中看到存在React组件,但它不希望加载与它关联的css。
// In App.js
import React from 'react';
import header_type from './header';
class App extends React.Component {
render() {
return
你好,我在学习React/redux
我创建了一个todo应用程序--它工作得很好,但是当我尝试用jsdom编写组件测试时,它显示了这个错误,花费了一些时间,但没有解决问题:
组件(它只是一个textfield +按钮)
import React from 'react'
import {addTodo} from '../actions'
import {connect} from 'react-redux'
let inputText
class AddTodo extends React.Component {
construc