Could the useState be used without the setter?
The Call Kent Podcast

Could the useState be used without the setter?

2021-12-13
I have a question... could the useState be used without using the setter? because a teammate use it in that way to get an item from sessionStorageconst [initialScrollPosition] = useState(() => Number.parseFloat(sessionStorage.getItem('offset') || 0)); and argues that this is so that the component is not unnecessarily rerendered and to read the sessionStorage only once! 🤔 but I think we can use useMemo for those cases but the useState is still used in this form in several components.useState lazy in...
View more
Comments (3)

More Episodes

All Episodes>>

Get this podcast on your phone, Free

Create Your Podcast In Minutes

  • Full-featured podcast site
  • Unlimited storage and bandwidth
  • Comprehensive podcast stats
  • Distribute to Apple Podcasts, Spotify, and more
  • Make money with your podcast
Get Started
It is Free