Material-UI。无效的挂接呼叫

时间:2019-10-23 13:56:27

标签: reactjs material-ui

我一直在跟踪一些有关如何使用React设置Material-UI的示例。 无论我尝试什么,我都会得到以下错误:

  

错误:最小化React错误#321;访问   https://reactjs.org/docs/error-decoder.html?invariant=321查看完整内容   消息,或使用非最小化的开发环境查看完整错误,并   其他有用的警告。

这似乎与Hook有关,但我找不到发生这种情况的任何原因。

组件

按钮

import React from 'react';
import { withStyles } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';

const styles = {
    root: {
        background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)',
        border: 0,
        borderRadius: 3,
        boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .3)',
        color: 'white',
        height: 48,
        padding: '0 30px',
    },
};

function ButtonComp(props) {
    const { classes } = props;
    return <Button className={classes.root}>Higher-order component</Button>;
}

export default withStyles(styles)(ButtonComp);

这样实现

import * as React from 'react';

import ButtonComp from './ButtonComp';

const App = ({ children }) => {
  return (
    <React.Fragment>
      <ButtonComp />
      <main>
        {children}
      </main>
    </React.Fragment>
  );
};

export default (App);

我正在react@16.11.0@material-ui/core@4.5.1上奔跑。

我在这里想念什么?我根本找不到问题。

0 个答案:

没有答案