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

Code Example 1

struct ContentView: View {
    @State var showsAlert = false
    var body: some View {
        Button(action: {
            self.showsAlert.toggle()
        }) {
            Text("Show Alert")
        }
        .alert(isPresented: self.$showsAlert) {
            Alert(title: Text("Hello"))
        }
    }
}

Learn ReactJs, React Native from akashmittal.com