/// <summary> /// Adds state to the store /// </summary> /// <returns>Store that inludes passed state and reducer</returns> /// <param name="initialState">Initial state value</param> /// <param name="reducer">Reducer function</param> /// <typeparam name="TState">State type</typeparam> public new Store WithState <TState>(TState initialState, Func <TState, Action, TState> reducer) { return(TryCreateStore(() => WithState( new StoreItem <TState>( StateWrapper.ForObject(() => initialState), reducer) ) )); }
/// <summary> /// Adds state to the store. /// </summary> /// <returns>Store that inludes passed state and reducer</returns> /// <param name="initialState">Initial state value</param> /// <param name="reducer">Reducer for the state</param> /// <typeparam name="TState">State type</typeparam> public new Store WithState <TState, TReducer>(TState initialState, TReducer reducer) where TReducer : Reducer <TState> { return(TryCreateStore(() => WithState( new StoreItem( StateWrapper.ForObject(() => initialState), ReducerWrapper.ForObject <TState, TReducer>(reducer)) ) )); }