Senior
November 18, 2026Spot the bug: React Native
One snippet. Find the bug, or prove there isn't one.
tsx
1import { useEffect, useState } from 'react'
2import { Text } from 'react-native'
3
4export function SearchResults({ query }: { query: string }) {
5 const [results, setResults] = useState<Result[]>([])
6
7 useEffect(() => {
8 const controller = new AbortController()
9 fetch(`/api/search?q=${encodeURIComponent(query)}`, { signal: controller.signal })
10 .then((r) => r.json())
11 .then(setResults)
12 .catch((e) => {
13 if (e.name !== 'AbortError') throw e
14 })
15 return () => controller.abort()
16 }, [query])
17
18 return <Text>{results.length} results</Text>
19}Click the lines that carry the problem.
Your verdict
One attempt per day. The answer shows up right after.
Keep your streak
Create an account to keep your streak and track your progress.