如何修复类型无效-react.js中需要字符串(对于内置组件)或类/函数吗?

dfty9e19  于 2021-09-23  发布在  Java
关注(0)|答案(0)|浏览(229)

我正在使用redux开发react应用程序,但在呈现 Jmeter 板组件时,我面临以下问题:

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `Layout`.
    at createFiberFromTypeAndProps (react-dom.development.js:25058)
    at createFiberFromElement (react-dom.development.js:25086)
    at reconcileSingleElement (react-dom.development.js:14052)
    at reconcileChildFibers (react-dom.development.js:14112)
    at reconcileChildren (react-dom.development.js:16990)
    at updateHostComponent (react-dom.development.js:17632)
    at beginWork (react-dom.development.js:19080)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
    at invokeGuardedCallback (react-dom.development.js:4056)

The above error occurred in the <div> component:

    at div
    at GridColumn (http://localhost:3000/static/js/bundle.js:67497:25)
    at div
    at GridRow (http://localhost:3000/static/js/bundle.js:67602:25)
    at div
    at Grid (http://localhost:3000/static/js/bundle.js:67387:23)
    at div
    at Layout
    at App (http://localhost:3000/static/js/bundle.js:40833:6)

这是我的 app.jsindex.js : index.js ```
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './index.css';
import { Provider } from 'react-redux';
import configureStore from '../src/clientDashboard/configureStore';
import { combineReducers } from 'redux';
import clients from '../src/clientDashboard/actions/clientReducer';
import Layout from './clientDashboard/Layout';
export default combineReducers({
clients: clients
});

const store = configureStore();
ReactDOM.render(
<React.StrictMode>
<Provider store={store}>

,

</React.StrictMode>, document.getElementById('root')

);

这是我的 `app.js` ```
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Layout from './clientDashboard/Layout';
import { BrowserRouter as Router, Route } from "react-router-dom";
import { Button } from 'semantic-ui-react';

class App extends Component {
  render() {
    return (

        <Layout/>

    );
  }
}

export default App;

这是我的 Layout 组成部分: Layout.jsx ```
import React from 'react';
import { Grid, Form } from 'semantic-ui-react';
import Typography from './ui-components/Typography';
import Table from './Table/Layout';
import Input from './SearchInput';
import styled from './constants/style/styled';
import colorPalette from './constants/style/colorPalette';
import CreatePopup from './Form/Popup';

const StyledTypography = styled(Typography)padding-right: 8px ;;

const StyledGridRow = styled(Grid.Row)padding-top: ${props => props.paddingtop} !important; padding-bottom: ${props => props.paddingbottom} !important;;

const Layout = () => (

export default Layout;

当我使用 `npm start` 我得到一个空白的白色页面,上面有给定的错误。
我们将非常感谢您的帮助。
谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题