TablePagination Reactjs错误KeyboardArrowRight

时间:2020-04-04 19:39:10

标签: reactjs material-ui

当我尝试使用material-ui分页对象时, [来自链接图像的错误] [1]

react-dom.development.js:19560上面的错误发生在组件中: 在/node_modules/@material-ui/core/esm/internal/svg-icons/KeyboardArrowRight.js中 跨度(由ForwardRef创建) in按钮(由ForwardRef创建) 在ForwardRef中(由WithStyles(ForwardRef)创建) 在WithStyles(ForwardRef)中(由ForwardRef创建) 在ForwardRef中(由WithStyles(ForwardRef)创建) 在WithStyles(ForwardRef)中(由ForwardRef创建) 在div中(由ForwardRef创建) 在ForwardRef中(由ForwardRef创建) 在div中(由ForwardRef创建) 在ForwardRef中(由WithStyles(ForwardRef)创建) 在WithStyles(ForwardRef)中(由ForwardRef创建) 在td中(由ForwardRef创建) 在ForwardRef中(由WithStyles(ForwardRef)创建) 在WithStyles(ForwardRef)中(由ForwardRef创建) 在ForwardRef中(由WithStyles(ForwardRef)创建) 在WithStyles(ForwardRef)中 在div中(由ForwardRef创建) 在ForwardRef中(由WithStyles(ForwardRef)创建) 在WithStyles(ForwardRef)中 在标题中 在div中 在主要(由r创建) 在div中(由t创建) 在div中(由t创建) 在t中(由r创建) 在div中(由r创建) 在div中(由r创建) 在r中(由x创建) 在x中 在Unknown中(由Context.Consumer创建) 在t中(由h创建) 在h 在div中 在Unknown中(由r创建) 在t中(由r创建) 在Suspense中(由r创建) 在r中(由x创建) 在x中(由r创建) 在r 在e 在t中(由n创建) 在n中(由Context.Consumer创建) 在i中(由x创建) 在x中 在t 在

考虑将错误边界添加到树中以自定义错误处理行为。

1 个答案:

答案 0 :(得分:0)

请尝试使用以下命令(使用npm或yarn)卸载@ material-ui / core:

useEffect(() => {
    const fetchInfo = async () => {
        let isSubscribed = true;
        const res = await fetch(`${api}&page=${page}`);
        if (isSubscribed) setLoading(true);
        try {
            const x = await res.json();
            if (page === 1) {
                setItems(x);
                setAutoplay(true);
            } else {
                setItems({
                    hasMore: x.hasMore,
                    vacancies: [...items.vacancies, ...x.vacancies]
                });
            }
        } catch (err) {
            console.log(err);
        }
        if (isSubscribed) setLoading(false);

        return () => (isSubscribed = false);
    };
    fetchInfo();
}, [page]);

,然后使用以下命令再次安装@ material-ui / core:

// with npm
npm uninstall @material-ui/core

// with yarn
yarn remove @material-ui/core