Why does ESlint airbnb not recommend changing setState? in the componentDidMount lifecycle function of react

I need to get the true height of the element to do something, and the most direct thing to do is certainly to get the height in componentDidMount and render it further. But the eslint I use gives a hint that it is not recommended to change setState, in the componentDidMount lifecycle function of react. Excuse me, why? If I don"t use this approach, how can I achieve my need to get the true height of the element?

clipboard.png

Mar.10,2021

in rules of eslintrc, change 'no-did-mount-set-state' to 0 .
this rule is airbnb, probably because it is worried about introducing and changing the endless cycle.


Resources

Updating the state after a component mount will trigger a second render () call and can lead to property/layout thrashing.

no-did-mount-set-state

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ab8b-2c242.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ab8b-2c242.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?