DEV Community

loading...

Discussion on: Things to know about useState

Collapse
awhite profile image
Alex White

Did not know about the lazy initializer. Will definitely be using that more in the future

Collapse
mbrtn profile image
Ruslan Shashkov

This is an antipattern anyway. Better to useMemo with useEffect in case of expensive calculations

Collapse
tkdodo profile image
Dominik D Author

Not sure what you mean with that. Do you have an example maybe?