Reactjs (0,_hoc.default)不是函数。允许使用Require循环,但可能会导致未初始化的值

Reactjs (0,_hoc.default)不是函数。允许使用Require循环,但可能会导致未初始化的值,reactjs,react-native,react-hooks,high-order-component,Reactjs,React Native,React Hooks,High Order Component,下面是我的错误:创建一个HOC use函数组件而不是类组件 Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. [Fri Oct 16 2020 24:17:29.696] ERROR TypeError: (0, _hoc.default) is not a function. (In '(

下面是我的错误:创建一个HOC use函数组件而不是类组件

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
    [Fri Oct 16 2020 24:17:29.696]  ERROR    TypeError: (0, _hoc.default) is not a function. (In '(0, _hoc.default)(BankingOnline)', '(0, _hoc.default)' is undefined)
    [Fri Oct 16 2020 24:17:29.696]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
    [Fri Oct 16 2020 24:17:29.696]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
    [Fri Oct 16 2020 24:17:29.697]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
我的代码:

import React, { useState, useContext, useEffect } from "react";
import HeaderComponent from '../../components/header';
import { StoreContext } from '../../store';
import NotAuthView from '../../components/notAuth-view'


const RequiredAuth = (Component) => props => {
    const { authFlag } = useContext(StoreContext)
    if (!authFlag) {
        return <NotAuthView />
    }

    return <Component {...props} />
}

export default RequiredAuth
import React,{useState,useContext,useffect}来自“React”;
从“../../components/header”导入HeaderComponent;
从“../../store”导入{StoreContext};
从“../../components/notAuth视图”导入NotAuthView
const RequiredAuth=(组件)=>props=>{
const{authFlag}=useContext(StoreContext)
如果(!authFlag){
返回
}
返回
}
导出默认要求的身份验证

有人有办法解决这个问题吗?非常感谢

我已经解决了这个问题! 感谢@lissettdm和@VietDinh。
这是我使用RequiredAuth时出现的问题。

您如何使用RequiredAuth HOC?RequiredAuth(组件)(道具)?你能展示一下你是如何使用RequiredAuth的吗?你能分享一下你是如何解决这个问题的吗?