NextJS元素类型无效



我在widget文件夹中创建了一个组件,并将其导入到我的主主页(index.js)

显示错误

Error: Element type is invalid: expected a string (for built-in components) or 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 have mixed up default and named imports.

主文件代码

import { React, Component } from "react";
import axios from "axios";
import Style from "./widget-style/Notified.module.css";
import NotifiedModal from "../modals/NotifiedModal";
export default class GetNotified extends Component {}

你必须像这样导入React:

import React, { Component } from "react";

第一个是默认导入,第二个是命名导入。

相关内容

  • 没有找到相关文章

最新更新