# Podstawowe zarządzanie stanem (Angular) > Component state, services state, BehaviorSubject, state patterns, stateful vs stateless components, shared state - 20 pytań z rozmów - Mid-Level - [Pytania z rozmów: Angular](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne.md) ## 1. Jaki jest najprostszy sposób zadeklarowania lokalnego stanu w komponencie Angular? **Odpowiedź** Zadeklarowanie właściwości klasy bezpośrednio w komponencie jest najprostszą metodą zarządzania lokalnym stanem. To podejście jest idealne dla danych używanych tylko przez ten komponent, które nie muszą być współdzielone. Właściwości są automatycznie dostępne w szablonie i mogą być modyfikowane bezpośrednio. ## 2. Jaka jest główna cecha komponentu stateless? **Odpowiedź** Komponent stateless nie ma wewnętrznego stanu i polega wyłącznie na @Input do otrzymywania danych. Komponenty te są czysto prezentacyjne i emitują zdarzenia przez @Output, aby komunikować się ze swoim rodzicem. Ta architektura poprawia możliwość ponownego użycia i ułatwia testowanie. ## 3. Dlaczego używać BehaviorSubject zamiast Subject do zarządzania stanem? **Odpowiedź** BehaviorSubject zawsze przechowuje ostatnią wyemitowaną wartość i natychmiast wysyła ją do nowych subscriberów. Ta cecha jest niezbędna do zarządzania stanem, ponieważ komponenty potrzebują dostępu do bieżącego stanu zaraz po inicjalizacji, bez czekania na nową emisję. Subject nie przechowuje żadnej wartości, a nowi subscriberzy otrzymują tylko przyszłe emisje. ## Jeszcze 17 dostępnych pytań - Jaka jest najlepsza praktyka udostępniania stanu zarządzanego przez serwis Angular? - Jak współdzielić stan między wieloma komponentami, które nie są powiązane relacją rodzic-dziecko? Zarejestruj się za darmo: https://sharpskill.dev/pl/login ## Inne tematy rekrutacyjne Angular - [Podstawy TypeScript](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/typescript-basics.md): 25 pytań, Junior - [TypeScript zaawansowany](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/typescript-advanced.md): 20 pytań, Junior - [Podstawy Angulara](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/angular-fundamentals.md): 20 pytań, Junior - [Komponenty i cykl życia](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/components-lifecycle.md): 20 pytań, Junior - [Services & Dependency Injection](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/services-dependency-injection.md): 20 pytań, Junior - [Organizacja modułów Angular](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/modules-organization.md): 22 pytań, Mid-Level - [Angular CLI](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/angular-cli.md): 18 pytań, Junior - [Dyrektywy i Pipe'y](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/directives-pipes.md): 22 pytań, Mid-Level - [Routing i Nawigacja](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/routing-navigation.md): 24 pytań, Mid-Level - [Formularze reaktywne](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/forms-reactive.md): 26 pytań, Mid-Level - [Formularze template-driven](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/forms-template-driven.md): 16 pytań, Mid-Level - [Podstawy RxJS](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/rxjs-fundamentals.md): 22 pytań, Mid-Level - [Operatory RxJS](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/rxjs-operators.md): 24 pytań, Mid-Level - [HttpClient i wywołania API](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/http-client.md): 22 pytań, Mid-Level - [Change Detection](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/change-detection.md): 20 pytań, Mid-Level - [Angular Signals](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/angular-signals.md): 20 pytań, Mid-Level - [Standalone Components](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/standalone-components.md): 18 pytań, Mid-Level - [Testy jednostkowe w Angular](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/testing-unit.md): 22 pytań, Mid-Level - [Testowanie End-to-End](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/testing-e2e.md): 18 pytań, Mid-Level - [Build i optymalizacja](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/build-optimization.md): 20 pytań, Mid-Level - [Podstawy NgRx](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/ngrx-fundamentals.md): 24 pytań, Senior - [Zaawansowany NgRx](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/ngrx-advanced.md): 24 pytań, Senior - [Architektura Angular](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/angular-architecture.md): 22 pytań, Senior - [Optymalizacja wydajności](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/performance-optimization.md): 22 pytań, Senior - [Bezpieczeństwo i najlepsze praktyki](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/security-best-practices.md): 20 pytań, Senior - [Zaawansowane wzorce RxJS](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/advanced-rxjs-patterns.md): 22 pytań, Senior - [Angular Universal i SSR](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/angular-universal-ssr.md): 20 pytań, Senior - [Angular Micro-frontends](https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/micro-frontends-angular.md): 20 pytań, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/pl/technologies/angular/pytania-rekrutacyjne/state-management-basics