← Boeing Interview Insights

Boeing·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Boeing Full-stack Engineer technical screen focused almost entirely on React hooks. The questions were discussion-style rather than coding, but the follow-ups got surprisingly specific and a few of them tripped me up more than I expected.

Questions Asked (9)

Q1

Explain how useState works and walk through how React handles state updates under the hood.

Technical Trade-offs
Author's notes

Felt fine here, covered batching and the fact that setState is async in terms of when the re-render happens.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining useState as a React Hook that adds state to functional components, then explain the internal mechanics: how React tracks state via a linked list of hooks, batches updates, and triggers re-renders. Use a simple counter example to illustrate the process from setState call to DOM update, emphasizing the asynchronous and batched nature of updates.

Pro tip: Mention that state updates are batched in React 18+ even in promises, timeouts, and native event handlers due to automatic batching, and that using the functional update form (prev => prev + 1) avoids stale state issues when updates depend on previous values.

1. Define useState and its purpose

Explain that useState is a Hook that lets you add React state to function components, returning a state variable and a setter function. Mention that it's called at the top level of a component to preserve state between renders.

2. Describe the internal hook mechanism

Explain that React maintains a linked list of hooks for each component instance, and useState initializes or retrieves the current state from the corresponding hook node. The setter function schedules an update and triggers a re-render.

3. Explain update scheduling and batching

Detail how React batches multiple state updates within event handlers (and in React 18+, in promises, timeouts, etc.) to avoid unnecessary re-renders. Updates are queued and processed asynchronously, often before the next paint.

4. Walk through the re-render and reconciliation process

Describe how after state updates are processed, React re-renders the component with the new state, compares the new virtual DOM with the previous one (reconciliation), and updates the real DOM efficiently.

5. Summarize with a concrete example

Use a simple counter component to illustrate the entire flow: clicking a button calls setCount, React batches the update, re-renders the component with the new count, and updates the DOM.

Key Points to Mention

  • useState returns an array with the current state and a setter function; the setter can take a new value or a function that receives the previous state.
  • React uses a linked list (fiber nodes) to store hook state for each component instance, preserving state across renders.
  • State updates are asynchronous and batched for performance; multiple setState calls in an event handler result in a single re-render.
  • React 18 introduced automatic batching for all updates, including those in promises, setTimeout, and native event handlers.
  • The functional update form (prev => prev + 1) ensures correct state updates when the new state depends on the previous state, avoiding stale closures.
  • After state updates, React re-renders the component, reconciles the virtual DOM, and commits only the necessary changes to the real DOM.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

How does the useEffect dependency array work, and what are the most common mistakes developers make with it?

Root Cause AnalysisTechnical Trade-offs
Author's notes

This one went long.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining the purpose of the dependency array in useEffect: it tells React when to re-run the effect by comparing dependencies between renders. Then, walk through the most common mistakes, such as missing dependencies, using objects/arrays as dependencies, and misunderstanding the empty array. Finally, tie it back to root cause analysis and trade-offs, emphasizing how these mistakes can lead to bugs and performance issues.

Pro tip: Mention that the dependency array is not a performance optimization tool but a correctness mechanism—React uses it to avoid stale closures. Also, highlight that using the ESLint plugin (exhaustive-deps) can catch many mistakes, but it's not a silver bullet; developers must understand the underlying principles.

1. Explain the dependency array

Describe how useEffect accepts a second argument, an array of dependencies. React compares these dependencies between renders using Object.is and re-runs the effect only if any dependency has changed.

2. Common mistake: missing dependencies

Discuss how omitting dependencies can cause stale closures, where the effect captures outdated values from the component scope. This often leads to bugs that are hard to trace.

3. Common mistake: incorrect dependencies

Explain that including objects, arrays, or functions as dependencies can cause infinite loops because they are recreated on every render. Solutions include useMemo, useCallback, or moving them inside the effect.

4. Common mistake: empty array misuse

Clarify that an empty array means the effect runs only once after the initial render, but it can still capture stale props/state. It's not equivalent to componentDidMount and should be used carefully.

5. Root cause analysis and trade-offs

Emphasize that understanding the dependency array is crucial for debugging. Trade-offs include using useCallback/useMemo to stabilize dependencies versus adding complexity, and relying on lint rules versus manual control.

Key Points to Mention

  • Dependency array controls when the effect re-runs by comparing dependencies with Object.is.
  • Missing dependencies cause stale closures and bugs that are hard to reproduce.
  • Objects, arrays, and functions as dependencies cause infinite loops due to referential inequality.
  • Empty array runs effect only once, but can still capture stale values from initial render.
  • useCallback and useMemo can stabilize dependencies but add complexity and should be used judiciously.
  • ESLint exhaustive-deps rule helps catch missing dependencies but may suggest unnecessary changes; understanding is key.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

What is the cleanup function in useEffect and when do you actually need it?

Technical Trade-offs
Author's notes

Short answer, covered subscriptions and timers.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clearly defining the cleanup function as the optional return value of useEffect, then explain its purpose: to clean up side effects before the component unmounts or before the effect re-runs. Focus on when it's actually needed—subscriptions, timers, event listeners, and async operations—and emphasize that it prevents memory leaks and stale behavior.

Pro tip: Mention that cleanup runs before every re-execution of the effect, not just on unmount, and that returning a cleanup function is a best practice even if you think it's unnecessary—it shows foresight and prevents subtle bugs.

1. Define the cleanup function

Explain that useEffect can return a function that React calls to clean up the previous effect. This function runs before the component unmounts and before the effect runs again due to dependency changes.

2. Explain why cleanup is needed

Describe the problems without cleanup: memory leaks, stale subscriptions, duplicate event listeners, and race conditions. Emphasize that cleanup ensures resources are released and the effect doesn't interfere with subsequent runs.

3. Identify common use cases

List scenarios where cleanup is essential: subscriptions (e.g., WebSocket, Firebase), timers (setTimeout/setInterval), event listeners (window resize, scroll), and asynchronous requests with cancellation (AbortController).

4. Discuss when cleanup is not needed

Clarify that cleanup is unnecessary for effects that don't create persistent side effects, such as logging or simple state updates. However, it's still good practice to return a cleanup function if there's any doubt.

5. Highlight best practices and trade-offs

Mention that cleanup should be idempotent and not cause side effects. Discuss the trade-off between over-cleaning (unnecessary complexity) and under-cleaning (bugs), and how to test cleanup behavior.

Key Points to Mention

  • Cleanup function runs before the next effect execution and on unmount.
  • Prevents memory leaks and stale closures by canceling subscriptions, timers, and requests.
  • Common examples: clearInterval, removeEventListener, AbortController for fetch.
  • Not needed for effects that don't create persistent side effects, but often safer to include.
  • Cleanup should not depend on props/state that change frequently to avoid unnecessary re-runs.
  • React 18 Strict Mode double-invokes effects in development to help catch missing cleanup.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

When does useMemo actually help performance, and when does it make things worse?

Technical Trade-offs
Author's notes

This is the question I wish I'd thought about more carefully before the interview.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining what useMemo does and the cost model behind it, then clearly distinguish scenarios where memoization saves expensive recomputation versus where it adds unnecessary overhead. Use concrete examples to illustrate both cases, and emphasize that the decision should be driven by profiling and measurement, not by default.

Pro tip: Mention that useMemo is not a semantic guarantee—React may discard memoized values—so never rely on it for correctness, only for performance. Also, highlight that in most cases, simpler alternatives like lifting state, splitting components, or using React.memo yield better results with less complexity.

1. Explain the purpose and cost of useMemo

Briefly state that useMemo caches the result of a function between renders, avoiding recomputation if dependencies haven't changed. But it also incurs overhead: storing the value, comparing dependencies, and potentially increasing memory usage.

2. Identify when useMemo helps

Describe cases where the computation is genuinely expensive (e.g., complex calculations, large array transformations) or where referential equality is needed for downstream optimizations (e.g., passing a memoized object to a React.memo component).

3. Identify when useMemo hurts

Explain that for cheap computations, the overhead of dependency comparison and cache management can outweigh the savings. Also, overusing useMemo can lead to stale closures, memory leaks, and code complexity without measurable benefit.

4. Emphasize measurement and profiling

Stress that the decision should be based on profiling (e.g., React DevTools Profiler) to confirm that the computation is a bottleneck. Premature optimization is a common pitfall.

5. Summarize with a balanced rule of thumb

Conclude that useMemo is a tool for specific, measured performance issues, not a default. Prefer simpler optimizations first, and only add useMemo when profiling shows a clear win.

Key Points to Mention

  • useMemo caches a computed value and only recomputes when dependencies change.
  • It helps when the computation is expensive or when referential equality is required for child component memoization.
  • It can hurt when the computation is cheap, as the overhead of dependency comparison and cache management may exceed the savings.
  • Overuse can lead to memory overhead, stale values, and increased code complexity.
  • Profiling with React DevTools is essential to identify actual performance bottlenecks.
  • Alternatives like React.memo, useCallback, or restructuring components may be more appropriate.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

What's the difference between useMemo and useCallback, and how do you decide which to use?

Technical Trade-offs
Author's notes

Pretty clean answer, useCallback is just useMemo for functions.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining both hooks clearly, emphasizing that useMemo memoizes a computed value while useCallback memoizes a function reference. Then explain the decision criteria: use useMemo for expensive calculations or to preserve referential equality of objects/arrays, and use useCallback to stabilize function identities passed to optimized child components or used in dependency arrays. Finally, discuss trade-offs and when to avoid overusing them.

Pro tip: Mention that premature optimization with these hooks can hurt performance and readability; always profile first and only memoize when you have a measurable bottleneck or a clear referential equality requirement.

1. Define useMemo

Explain that useMemo returns a memoized value, recomputing it only when dependencies change. It's used to avoid expensive recalculations on every render.

2. Define useCallback

Explain that useCallback returns a memoized version of a callback function, changing only when dependencies change. It's used to prevent unnecessary re-renders of child components that rely on reference equality.

3. Compare and contrast

Highlight that useMemo is for values and useCallback is for functions, but useCallback(fn, deps) is essentially useMemo(() => fn, deps). Both help with referential equality and performance optimization.

4. Decision criteria

Describe when to use each: use useMemo for expensive computations or to keep object/array references stable; use useCallback for event handlers or functions passed to memoized child components (React.memo) or included in dependency arrays.

5. Trade-offs and best practices

Discuss that overusing these hooks can add complexity and memory overhead without benefit. Recommend profiling and only optimizing when necessary, and note that React may discard memoized values in future.

Key Points to Mention

  • useMemo memoizes a value; useCallback memoizes a function.
  • Both rely on a dependency array and only recompute when dependencies change.
  • useCallback is useful for passing stable callbacks to optimized child components (e.g., React.memo).
  • useMemo is useful for expensive calculations or preserving referential equality of objects/arrays.
  • Overuse can lead to unnecessary complexity and memory usage; profile before optimizing.
  • They are performance optimizations, not semantic guarantees—React may still re-run them.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q6

What is useRef used for beyond just storing DOM references?

Technical Trade-offs
Author's notes

Talked about persisting values across renders without triggering a re-render.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by acknowledging the common use of useRef for DOM references, then pivot to its broader purpose as a mutable container that persists across renders without causing re-renders. Explain how this makes it useful for storing any value that should not trigger a render when updated, and give concrete examples like timers, previous values, and instance variables.

Pro tip: Emphasize that useRef is not just for DOM—it's a general-purpose 'box' for mutable data. Mention that unlike state, updating ref.current does not cause a re-render, which is crucial for performance-sensitive scenarios.

1. Acknowledge common use

Briefly mention the typical use case of accessing DOM elements, showing you understand the basics.

2. Define core characteristic

Explain that useRef returns a mutable object whose .current property persists across renders and does not trigger re-renders when changed.

3. List alternative use cases

Provide examples such as storing timer IDs, previous state/props, instance variables, or any value that needs to be mutable without causing re-renders.

4. Contrast with state

Highlight the difference: state updates cause re-renders, while ref updates do not, making refs ideal for non-visual data.

5. Relate to performance and trade-offs

Discuss how using refs can optimize performance by avoiding unnecessary renders, but caution about overuse and potential pitfalls like stale closures.

Key Points to Mention

  • useRef returns a mutable object with a .current property that persists for the full lifetime of the component.
  • Updating ref.current does not trigger a re-render, unlike state updates.
  • Common non-DOM uses: storing timer IDs, previous values, instance variables, and any mutable value that shouldn't cause re-renders.
  • Refs are useful for integrating with third-party DOM libraries or imperative APIs.
  • Trade-offs: refs can lead to less predictable code if overused; they should not replace state for values that affect rendering.
  • In class components, refs are similar to instance fields, but useRef brings that capability to function components.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q7

How does useContext work and what are the performance implications of using it?

Technical Trade-offsSystem Design
Author's notes

Covered the basics but stumbled a little on the performance side.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining the mechanics of useContext: how it creates a global state accessible to any component in the tree without prop drilling. Then, discuss the performance implications: context updates trigger re-renders of all consuming components, which can be costly if not optimized. Finally, mention strategies to mitigate performance issues, such as splitting contexts, memoizing values, and using selectors.

Pro tip: Emphasize that useContext is not a state management solution by itself; it's a dependency injection mechanism. Combine it with useReducer or external stores for complex state, and always consider the re-render cost in large applications like those at Boeing.

1. Explain useContext Basics

Describe how useContext allows components to subscribe to a context object, avoiding prop drilling. Mention that it's often used with createContext and a Provider at the top of the tree.

2. Detail the Re-render Behavior

Explain that when the context value changes, all components that consume that context will re-render, regardless of whether they use the changed part of the value. This can lead to performance bottlenecks.

3. Discuss Performance Implications

Highlight that frequent updates or large context values can cause unnecessary re-renders, impacting performance. Mention that this is especially critical in large-scale applications with many consumers.

4. Offer Optimization Techniques

Suggest strategies like splitting contexts to isolate updates, memoizing context values with useMemo, and using libraries like use-context-selector to enable selective re-rendering.

5. Relate to Real-World Scenarios

Connect the discussion to system design trade-offs, such as when to use context versus other state management solutions (e.g., Redux, Zustand) based on performance needs and application complexity.

Key Points to Mention

  • useContext avoids prop drilling by providing a way to pass data through the component tree without manually passing props at every level.
  • Context updates cause all consuming components to re-render, which can be a performance issue if the context value changes frequently or if there are many consumers.
  • Splitting contexts into multiple smaller contexts can reduce unnecessary re-renders by isolating state changes to relevant consumers.
  • Memoizing the context value with useMemo or useCallback can prevent re-renders when the parent re-renders but the context value hasn't changed.
  • Libraries like use-context-selector or Recoil allow components to subscribe to only part of the context, minimizing re-renders.
  • In large applications, consider using context for low-frequency updates (e.g., theme, auth) and other state management for high-frequency updates.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q8

How do you build a custom hook and what are the rules you have to follow when writing one?

Technical Trade-offsAPI & Integrations
Author's notes

Rules of hooks came up here: only call hooks at the top level, only call them from React functions.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining what a custom hook is and why you'd build one, then walk through a concrete example (e.g., useFetch or useForm) that shows extraction of reusable logic. Finally, explicitly state the rules of hooks and how you enforce them, tying back to code quality and maintainability.

Pro tip: Mention that custom hooks are about sharing logic, not state, and that you can use tools like ESLint's react-hooks plugin to catch rule violations early. This shows you care about correctness and team scalability.

1. Define the purpose

Explain that a custom hook is a JavaScript function whose name starts with 'use' and that calls other hooks, allowing you to extract and reuse stateful logic across components.

2. Walk through an example

Describe a simple custom hook like useFetch that manages loading, error, and data states, and show how it's used in a component.

3. State the rules of hooks

List the two core rules: only call hooks at the top level (not inside loops, conditions, or nested functions) and only call hooks from React function components or other custom hooks.

4. Explain enforcement and benefits

Mention that ESLint's react-hooks plugin enforces these rules, and highlight benefits like reusability, testability, and separation of concerns.

Key Points to Mention

  • Custom hooks must start with 'use' to follow convention and enable linting.
  • Rules of hooks: top-level calls only, and only from React functions or other hooks.
  • Custom hooks share logic, not state—each call gets its own isolated state.
  • Use ESLint plugin (eslint-plugin-react-hooks) to enforce rules automatically.
  • Examples: useFetch, useForm, useLocalStorage, useAuth.
  • Benefits: code reuse, cleaner components, easier testing and maintenance.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q9

What triggers a re-render in React and how would you go about diagnosing an unexpected one?

Root Cause AnalysisTechnical Trade-offs
Author's notes

State change, prop change, context change, parent re-render.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clearly explaining the common triggers of re-renders in React, then transition into a systematic diagnostic process. Emphasize a methodical approach to identify the root cause, using tools like React DevTools and profiling, and discuss potential fixes.

Pro tip: Mention that unexpected re-renders often stem from parent component re-renders or context changes, and highlight the importance of using React.memo and useCallback to optimize performance.

1. Explain re-render triggers

List the primary causes: state changes, prop changes, context changes, and parent re-renders. Briefly explain each.

2. Describe diagnostic tools

Mention React DevTools Profiler, console.log statements, and the why-did-you-render library to track re-renders.

3. Outline a systematic process

Start by reproducing the issue, then use profiling to identify which components re-render and why. Check for unnecessary state updates or prop drilling.

4. Propose solutions

Suggest optimizations like React.memo, useMemo, useCallback, and moving state closer to where it's needed. Discuss trade-offs.

Key Points to Mention

  • State updates via useState or useReducer
  • Parent component re-renders causing child re-renders
  • Context value changes triggering re-renders in consumers
  • React DevTools Profiler for identifying performance bottlenecks
  • why-did-you-render library for tracking unnecessary re-renders
  • Optimization techniques: React.memo, useMemo, useCallback, and code-splitting

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.