How i can get last value of state? without subscribing (rxJs)

i have this on facade

chatMessagesState$ = this.store.pipe(select(ChatMessageSelectors.getChatMessagesState));
 

this on selector

export const getChatMessagesState = createSelector(
  getChatMessages,
  (payload: ChatMessagesState) => payload
);

and this on component

   this.chatMessagesSub = this.chatMessagesFacade.chatMessagesState$.subscribe(state => {
        if (state.messages) {
        // do something
        }
  });
    

how i can take state, without subscribing?

Answer

 constructor(private storeState: State<YourState>)

 const state = this.storeState.value['your-state'];

If you need to take the value just 1 time