Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Very well explained, with nice little animations to toggle on the way !

For those copying/getting inspired by the code, don't forget to add the missing empty-array for the useLayoutEffet dependency param.



That would measure the component only on mount, so it would not notice if it’s layout changed.

You need to run it without the dependency array or add all layout-changing props and state to it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: