//
//  RootView.swift
//  Root
//

import SwiftUI
import Facts
import ComposableArchitecture

public struct RootView: View {
    @Bindable var store: StoreOf<RootFeature>

    public init(store: StoreOf<RootFeature>) {
        self.store = store
    }
    
    public var body: some View {
        NavigationStack {
            FactsView(store: store.scope(state: \.facts, action: \.facts))
        }.onAppear {
            store.send(.viewAppeared)
        }
    }
}

#Preview {
    RootView(store: .init(initialState: RootFeature.State()) {
        RootFeature()
    })
}
