New UserProfile component in the project. A colleague adds it — fetch data when userId changes, show loading, then the profile. When switching quickly, UX testers notice "flashes" of old data. Walk the diff and explain the cause.
Клик по строке diff — напиши свой комментарий. Когда закончишь, жми «Отправить ревью».Туториал этого урока
1-// UserProfile.tsx — new component
1+import { useEffect, useState } from 'react'
2+
3+interface User {
4+ id: string
5+ name: string
6+ email: string
7+}
8+
9+interface Props {
10+ userId: string
11+}
12+
13+export function UserProfile({ userId }: Props) {