ระดับกลาง
4 ตุลาคม 2569

หาบั๊กให้เจอ: React Native

โค้ดหนึ่งชิ้น หาบั๊กให้เจอ หรือพิสูจน์ว่าไม่มีบั๊ก

tsx
1import { Alert } from 'react-native'
2
3type Status = 'idle' | 'loading' | 'success' | 'error'
4
5export function notify(status: Status) {
6  switch (status) {
7    case 'loading':
8      Alert.alert('Loading...')
9    case 'success':
10      Alert.alert('Done!')
11      break
12    case 'error':
13      Alert.alert('Failed')
14      break
15    default:
16      break
17  }
18}

คลิกบรรทัดที่เป็นต้นเหตุของปัญหา

คำตัดสินของคุณ

วันละหนึ่งครั้ง คำตอบจะแสดงทันทีหลังจากนั้น

รักษาสถิติต่อเนื่องของคุณ

สร้างบัญชีเพื่อเก็บสถิติต่อเนื่องและติดตามความคืบหน้า

สร้างบัญชี