ant-design / antd-style

css-in-js library with antd v5 token system

Home Page:https://ant-design.github.io/antd-style/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🐛[BUG] Vscode报 “ThemeProvider”不能用作 JSX 组件 & 控制台报 Cannot read properties of undefined (reading 'useToken')

consistent-k opened this issue · comments

🐛 bug 描述

image

image

📷 复现步骤

🏞 期望结果

💻 复现代码

import { createStyles, ThemeProvider } from 'antd-style';

const useStyles = createStyles(({ stylish, cx, css, token }) => {
    return {
        btn: {
            color: 'red'
        }
    };
});


const App = () => {
    const { styles } = useStyles();
    return (
        <div className={styles.btn}>
            按钮
        </div>
    );
};
export default () => {
    return (
        <ThemeProvider>
            <App />
        </ThemeProvider>
    );
};

© 版本信息

  • antd-style 版本: 3.3.0
  • 浏览器环境 chrome
  • 开发环境 Macos

🚑 其他信息

umi4框架 & antd4

不支持 antd 4,请升级到 antd v5 后再尝试使用

@BrettKimmons 给个复现demo