I'm using Button and Input of antd in vscode. But It shows error on Button and I want to know why.
I have tried Input, and it shows no error. Which is showed in the picture.
import React from 'react';
import styles from './index.css';
import router from 'umi/router';
import {Input, Button} from 'antd';
export default function() {
const handleClick=()=>{
router.push('/homepage/');
}
return (
<div className={styles.normal}>
<div className={styles.welcome} />
<h1 className={styles.title}>login</h1>
<ul className={styles.list}>
<li><label>username:</label><Input className={styles.input} placeholder="username"/></li>
<li><label>password:</label><Input className={styles.input} placeholder="password"/></li>
<li>
<Button type="primary" shape="round" onClick={handleClick}>login</Button>
</li>
</ul>
</div>
);
}
The actual output shows:
<--language:lang-none-->
"message": "Type '{ children: string; type: \"primary\"; shape: \"round\"; onClick: () => void; }' is missing the following properties from type 'Pick<Pick<(Readonly<AnchorButtonProps> & Readonly<{ children?: ReactNode; }>) | (Readonly<NativeButtonProps> & Readonly<{ children?: ReactNode; }>), \"defaultChecked\" | \"defaultValue\" | ... 257 more ... | \"block\"> & Pick<...> & Pick<...>, \"defaultChecked\" | ... 256 more ... | \"shape\">': defaultChecked, defaultValue, suppressContentEditableWarning, suppressHydrationWarning, and 250 more."
plus, I want to ask how to use static resource? The sample project just use the css background url way to show pictures.

Hello I have updated @types/react as 16.8.11 in my package.json. This solved my problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With