Today I saw this React hook (see photo) get shared on birdsite. It enables one to “automatically scroll down when new messages arrive in a chat”.

While it might work, you could — and should — use this little bit of CSS instead:

```
.log {
scroll-snap-type: y proximity;
align-content: end;
}
.log::after {
display: block;
content: "";
scroll-snap-align: end;
}
```

“… remains snapped to the bottom …unless the user has scrolled away from that edge” — https://drafts.csswg.org/css-scroll-snap/#example-d0a2d86f

CSS Scroll Snap Module Level 1

@bramus I wrote a hook for exactly this purpose and looking decently similar back in 2018 which is still in service. Pretty amazing to see it completely unnecessary now.
@sangster The web always catches up (eventually) 😊
@bramus well technically mine also does data fetching for infinite scroll but it would be significantly simpler without the scroll behavior