All fields

“Lifecycle Hooks” in Information Technology

35 questions across 5 technologies.

Information Technology

35 questions in 5 technologies

#QuestionTechnologyTopicLevel
1What are lifecycle hooks in Angular and why would you use them? Angular › Lifecycle HooksAngularLifecycle HooksBeginner
2What is the correct order in which Angular calls the main lifecycle hooks during a component's life? Angular › Lifecycle HooksAngularLifecycle HooksAdvanced
3Why is the constructor generally not the right place to fetch data or perform complex setup in an Angular component? Angular › Lifecycle HooksAngularLifecycle HooksBeginner
4What does ngOnDestroy do, and why is it important for cleaning up resources like subscriptions? Angular › Lifecycle HooksAngularLifecycle HooksIntermediate
5What is the difference between ngOnChanges and ngOnInit, and when does each run? Angular › Lifecycle HooksAngularLifecycle HooksIntermediate
6How do CodeDeploy lifecycle hooks defined in an appspec file control the deployment process? AWS › AWS CodePipeline, CodeBuild & CodeDeploy (CI/CD)AWSAWS CodePipeline, CodeBuild & CodeDeploy (CI/CD)Intermediate
7How do lifecycle hooks in Auto Scaling Groups let you customize instance launch and termination behavior? AWS › Auto Scaling GroupsAWSAuto Scaling GroupsAdvanced
8What does componentDidMount do in a class component and what is its equivalent using hooks? React › Class Components & Legacy Lifecycle MethodsReactClass Components & Legacy Lifecycle MethodsIntermediate
9What is IHostedLifecycleService, and how does it provide more granular hooks than IHostedService's StartAsync/StopAsync? .NET › Background Services.NETBackground ServicesAdvanced
10How would you use async_hooks (the lower-level predecessor to AsyncLocalStorage) to trace the lifecycle of asynchronous resources in Node.js? Node.js › Event Loop & Non-blocking IONode.jsEvent Loop & Non-blocking IOAdvanced
11What is a custom hook in React and why would you create one? React › Custom HooksReactCustom HooksBeginner
12What is the difference between useEffect and code that runs directly during rendering? React › Effects & LifecycleReactEffects & LifecycleBeginner
13What is a class component in React and how does it differ from a function component? React › Class Components & Legacy Lifecycle MethodsReactClass Components & Legacy Lifecycle MethodsBeginner
14What is the useEffect hook used for in React? React › Effects & LifecycleReactEffects & LifecycleBeginner
15What does the useState hook do, and how do you use it? React › HooksReactHooksBeginner
16Why can only class components be used as error boundaries in React? React › Class Components & Legacy Lifecycle MethodsReactClass Components & Legacy Lifecycle MethodsIntermediate
17What is useLayoutEffect and how is it different from the regular useEffect hook? React › Concurrent Hooks (useTransition, useDeferredValue & useLayoutEffect)ReactConcurrent Hooks (useTransition, useDeferredValue & useLayoutEffect)Intermediate
18How would you write a custom hook to fetch data from an API and share that logic across components? React › Custom HooksReactCustom HooksIntermediate
19What does the dependency array in useEffect actually control? React › Effects & LifecycleReactEffects & LifecycleIntermediate
20How do you clean up an effect in React, and why is it important? React › Effects & LifecycleReactEffects & LifecycleIntermediate
21What is the useMemo hook and how does it help with performance? React › HooksReactHooksIntermediate
22How would you build a custom hook that debounces a fast changing value, such as text typed into a search box? React › Custom HooksReactCustom HooksAdvanced
23What problem do libraries like React Query and SWR solve compared to fetching data with plain useEffect? React › Data Fetching (React Query & SWR)ReactData Fetching (React Query & SWR)Beginner
24Why is it usually better to use a data fetching library instead of writing your own fetch logic in every component? React › Data Fetching (React Query & SWR)ReactData Fetching (React Query & SWR)Beginner
25What is the difference between a ref created with useRef and one created with createRef? React › Refs, useRef & forwardRefReactRefs, useRef & forwardRefBeginner
26What is the difference between using a resolver and simply fetching data inside a component's ngOnInit method? Angular › Router Guards & ResolversAngularRouter Guards & ResolversBeginner
27What is the difference between ViewChild and ContentChild in Angular? Angular › Template Reference Variables & ViewChildAngularTemplate Reference Variables & ViewChildBeginner
28How is useRef different from useState when it comes to storing a value? React › Refs, useRef & forwardRefReactRefs, useRef & forwardRefIntermediate
29How would you use a ref to keep track of a component's previous prop value? React › Refs, useRef & forwardRefReactRefs, useRef & forwardRefIntermediate
30Why does Strict Mode call component functions and certain effects twice during development? React › Strict Mode & Concurrent FeaturesReactStrict Mode & Concurrent FeaturesIntermediate
31How would you check whether any content was actually projected into a component using ng-content? Angular › Content Projection (ng-content)AngularContent Projection (ng-content)Intermediate
32How does the async pipe simplify working with observables directly in an Angular template? Angular › Pipes (Built-in & Custom)AngularPipes (Built-in & Custom)Intermediate
33Why is it important to unsubscribe from an RxJS observable, and what are common ways to do this correctly in Angular? Angular › RxJS & ObservablesAngularRxJS & ObservablesIntermediate
34What does the ViewChild decorator do, and how would you use it to access a child component from a parent's TypeScript code? Angular › Template Reference Variables & ViewChildAngularTemplate Reference Variables & ViewChildIntermediate
35How does the newer signal based viewChild function differ from the traditional ViewChild decorator? Angular › Template Reference Variables & ViewChildAngularTemplate Reference Variables & ViewChildIntermediate