ミドル
2026年8月19日

バグを見つけろ:React Native

コードは1つ。バグを見つけるか、バグがないことを示してください。

tsx
1import * as SQLite from 'expo-sqlite'
2
3const db = SQLite.openDatabaseSync('blog.db')
4
5type Post = { id: number; title: string; author_id: number }
6
7export async function loadPostsWithAuthors() {
8  const posts = await db.getAllAsync<Post>('SELECT id, title, author_id FROM posts')
9  const enriched = []
10  for (const post of posts) {
11    const author = await db.getFirstAsync(
12      'SELECT name FROM users WHERE id = ?',
13      post.author_id
14    )
15    enriched.push({ ...post, author })
16  }
17  return enriched
18}

問題のある行をクリックしてください。

あなたの判断

1日1回まで。回答するとすぐに正解が表示されます。

連続記録を守る

アカウントを作成すると連続記録を保存し、進捗を追跡できます。

アカウントを作成