Skip to content

Commit 13908c7

Browse files
committed
small change
1 parent 0a3f264 commit 13908c7

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

react/advanced-hooks/01-useEffect/practice-chat-room/ChatRoom.final.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@ export function ChatRoom({ user }: Props) {
9090
const e = event.target
9191
// See if the user scrolled to the bottom
9292
const bottom = e.scrollHeight <= Math.ceil(e.scrollTop + e.clientHeight)
93-
// If the user is in a different scroll position from what we have
94-
// in state, update the state
95-
if (scrolledToBottom !== bottom) {
96-
setScrolledToBottom(bottom)
97-
}
93+
setScrolledToBottom(bottom)
9894
}
9995

10096
return (

react/advanced-hooks/01-useEffect/practice-chat-room/ChatRoom.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ export function ChatRoom({ user }: Props) {
5858
const e = event.target
5959
// See if the user scrolled to the bottom
6060
const bottom = e.scrollHeight <= Math.ceil(e.scrollTop + e.clientHeight)
61-
// If the user is in a different scroll position from what we have
62-
// in state, update the state
61+
// ⭐️⭐️⭐️ Let's talk about this if-statement and why it's actually not needed
6362
if (scrolledToBottom !== bottom) {
6463
setScrolledToBottom(bottom)
6564
}

0 commit comments

Comments
 (0)