最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Cannot read properties of null (reading 'pulsate') in material-ui Button component - Stack Overflow

programmeradmin0浏览0评论

This is version of material-ui that I am using :

"@mui/icons-material": "^5.5.1",
"@mui/material": "^5.5.1",

This is how I imported Button ponent :

import Button from "@mui/material/Button";

This is how I am using Button :

<Button variant="contained"
   className={styles.contactBtn}
   autoFocus
   onClick={handleClose}
>
   Close
</Button>

I am getting an error like this : Cannot read properties of null (reading 'pulsate')

I found this thread(solution) from github Link , but it did not solved my issue . How do I fix this ?

This is version of material-ui that I am using :

"@mui/icons-material": "^5.5.1",
"@mui/material": "^5.5.1",

This is how I imported Button ponent :

import Button from "@mui/material/Button";

This is how I am using Button :

<Button variant="contained"
   className={styles.contactBtn}
   autoFocus
   onClick={handleClose}
>
   Close
</Button>

I am getting an error like this : Cannot read properties of null (reading 'pulsate')

I found this thread(solution) from github Link , but it did not solved my issue . How do I fix this ?

Share Improve this question edited May 7, 2022 at 14:40 Hritik Sharma asked May 7, 2022 at 10:06 Hritik SharmaHritik Sharma 2,0201 gold badge11 silver badges27 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

I tried removing each prop in button and checked whether it is working or not.

I found, autoFocus prop should have value true or false.

It does not set defaultValue as true or false, ideally it should set a defaultValue.

<Button variant="contained"
   className={styles.contactBtn}
   onClick={handleClose}
   autoFocus={true}
>
   Close
</Button>

autoFocus should have value true or false. It should not be null.

Read the mui docs for the same. Mui has very well documented the solution to this problem.

发布评论

评论列表(0)

  1. 暂无评论