Check out example codes for "swiftui foreach". It will help you in understanding the concepts better.

Code Example 1

ForEach(1...5) { row in
    Text("Row \(row)")
}

Code Example 2

struct ContentView: View {
    let colors: [Color] = [.red, .green, .blue]

    var body: some View {
        VStack {
            ForEach(colors, id: \.self) { color in
                Text(color.description.capitalized)
                    .padding()
                    .background(color)
            }
        }
    }
}

Learn ReactJs, React Native from akashmittal.com