π React Props β Complete In-Depth Theory Guide
1. Introduction
πΉ What are Props?
Props (short for βpropertiesβ) are inputs passed from a parent component to a child component in React. They allow components to be:- Dynamic
- Reusable
- Configurable
πΉ Why Props are Important in React
Props are fundamental because they enable:-
Component Reusability
- Same component, different data
-
Separation of Concerns
- Logic in parent, UI in child
-
Data Flow
- Enables unidirectional data flow (top β down)
πΉ When and Why We Use Props
Use props when:- You want to pass data to child components
- You need to customize UI behavior
- You want to share state across components
- You are building composable UI systems
2. Concepts / Internal Workings
πΉ Unidirectional Data Flow
React follows a one-way data flow:- Props flow down the component tree
- Child cannot directly modify parent data
πΉ Props are Immutable
Props are read-only objects.- Prevent side effects
- Ensure predictable UI updates
πΉ How Props Work Internally
Under the hood:- React creates a virtual DOM element
- Props are stored as an object inside it
-
During rendering:
- React compares old vs new props (diffing)
- Updates only what changed
πΉ Props vs State
πΉ Relationship with Other React Features
-
Hooks (
useState,useEffect)- Props often trigger effects
-
Context API
- Alternative to passing props deeply (prop drilling)
-
Memoization (
React.memo)- Props are used for comparison to prevent re-renders
3. Syntax & Examples
πΉ Basic Props Passing
πΉ Destructuring Props
πΉ Passing Multiple Props
πΉ Default Props
πΉ Passing Functions as Props
πΉ Passing Objects & Arrays
πΉ Children Prop
children is a special prop
πΉ Spread Props
πΉ Conditional Props
πΉ Inline Expressions
4. Edge Cases / Common Mistakes
β Mutating Props
β Prop Drilling
- Context API
- State management (Redux, Zustand)
β Re-render Issues with Objects/Functions
β Missing Props
name is undefined
β
Fix:
β Incorrect Type Usage
Passing wrong types can break UI. β Solution:- Use TypeScript or PropTypes
β Overusing Props
Too many props β hard to maintain- Group into objects
- Refactor components
5. Best Practices
β Keep Props Minimal
- Pass only what is needed
- Avoid unnecessary data
β Use Destructuring
β Use Meaningful Names
β Avoid Inline Functions (When Needed)
β Memoization for Performance
Use:React.memouseMemouseCallback
β Validate Props
Using TypeScript:β Component Composition over Props Explosion
Instead of:β Avoid Deep Prop Drilling
Use:- Context API
- Global state management
β Keep Components Pure
Props in β UI outπ Summary
Props are:- Immutable inputs
- Used for component communication
- Key to reusability and composition
- Design scalable UI
- Optimize performance
- Write maintainable React code
π React Props β Senior-Level Conceptual Interview Questions
1. Why are props immutable in React? What would break if they were mutable?
β Strong Answer
Props are immutable to maintain predictability and consistency in rendering.WHY:
- React relies on pure component rendering
- Immutability enables efficient diffing (reconciliation)
- Prevents side effects across component boundaries
- Child components could silently modify parent data
- Reactβs Virtual DOM diffing would become unreliable
- Debugging becomes extremely difficult due to hidden mutations
Comparison:
- Props β Immutable (controlled externally)
- State β Mutable (controlled internally)
2. How does React detect prop changes during reconciliation?
β Strong Answer
React uses shallow comparison of props during reconciliation.HOW:
-
When a component re-renders:
- React compares previous props vs new props
- If different β re-render child
WHY:
- Shallow comparison is fast (O(n))
- Deep comparison would be expensive
Optimization:
Alternative:
React.memo()for functional components
3. Explain prop drilling. When is it actually acceptable?
β Strong Answer
Prop drilling is passing props through multiple intermediate components.Problem:
- Intermediate components donβt use the data
- Leads to tight coupling and poor maintainability
When itβs OK:
- Small component trees
- Clear ownership of data
- Avoids unnecessary abstraction
When NOT:
- Deep trees
- Frequently changing data
Alternatives:
- Context API
- State management libraries
4. What are the trade-offs between props and Context API?
β Strong Answer
Trade-offs:
Props- β Transparent data flow
- β Verbose (prop drilling)
- β Eliminates drilling
- β Can cause unnecessary re-renders
Key Insight:
Context is not a replacement for props β itβs a complement5. Why do inline objects/functions in props cause performance issues?
β Strong Answer
Because they create new references on every render.- Old function !== New function β triggers re-render
WHY:
- JavaScript compares objects/functions by reference
Fix:
When it matters:
- In memoized components (
React.memo)
6. How do props enable inversion of control in React?
β Strong Answer
Props allow parent components to control child behavior.Example:
WHY:
- Promotes flexibility and reusability
- Decouples logic from UI
Alternative:
- Hardcoding logic inside component β less reusable
7. What is the βchildrenβ prop and why is it powerful?
β Strong Answer
children allows components to act as wrappers or layouts.
WHY powerful:
- Enables composition over configuration
- Avoids prop explosion
Alternative:
8. How does React.memo interact with props?
β Strong Answer
React.memo prevents re-render if props havenβt changed (shallow comparison).
Pitfall:
WHY:
- New reference each render
Fix:
- Memoize props
- Use custom comparison function
9. What happens when props change? Describe the full lifecycle.
β Strong Answer
- Parent re-renders
- New props passed to child
- React compares old vs new props
-
If changed:
- Child re-renders
- Effects may run (
useEffect)
Important:
- Even if props are same β child may still re-render (unless memoized)
10. Can a component re-render without prop changes?
β Strong Answer
Yes.Reasons:
- Parent re-render
- Internal state changes
- Context updates
name didnβt change.
Optimization:
React.memo
11. Why is passing large objects as props risky?
β Strong Answer
- Causes frequent re-renders
- Harder to track changes
- Breaks memoization
Better:
Trade-off:
- Granularity vs convenience
12. How do you handle optional props safely?
β Strong Answer
Use:- Default values
- Type checking
WHY:
Prevents runtime errors:13. Explain controlled vs uncontrolled behavior using props.
β Strong Answer
Controlled component:- Parent controls value via props
- Component manages its own state
WHY:
- Controlled β predictable
- Uncontrolled β simpler but less control
14. What are the dangers of βprop explosionβ?
β Strong Answer
Too many props:Problems:
- Hard to maintain
- Poor readability
- Tight coupling
Solutions:
- Group into objects
- Use composition
15. When should you derive state from props (and when not)?
β Strong Answer
Avoid:
WHY:
- Leads to stale state
- Sync issues
Use only when:
- Need to transform props once
Alternative:
- Compute directly from props
- Use memoization
16. How do props interact with hooks like useEffect?
β Strong Answer
Props can trigger effects:WHY:
- Dependency array watches prop changes
Pitfall:
- Missing dependency β stale data
- Over-dependency β unnecessary calls
17. What is a render prop pattern and how does it differ from normal props?
β Strong Answer
A render prop is a function prop that returns JSX.WHY:
- Enables dynamic rendering logic
vs Normal Props:
- Normal β static data
- Render prop β dynamic UI logic
18. How would you design a highly reusable component using props?
β Strong Answer
Principles:- Keep props minimal
- Use
children - Accept behavior via callbacks
WHY:
- Flexible
- Composable
- Decoupled
π Final Takeaway
Senior-level understanding of props is about:- Data flow architecture
- Performance implications
- Component design philosophy
- Trade-offs between abstraction vs simplicity
π React Props β Senior-Level MCQs (Deep Understanding)
1. What happens in the following scenario?
Options:
A. Child renders only once B. Child re-renders on every Parent render C. Child never re-renders D. React throws an errorβ Correct Answer: B
β Explanation:
- A new object is created on every render β new reference
- React sees
dataas changed β triggers re-render
β Why others are wrong:
- A: Incorrect β reference changes every time
- C: Impossible unless memoized
- D: No error here
2. What will prevent unnecessary re-renders here?
Options:
A. Wrap Child withReact.memo only
B. Use useMemo for config
C. Use useCallback
D. Nothing can prevent it
β Correct Answer: B
β Explanation:
- Object literal creates new reference
useMemostabilizes it
β Why others are wrong:
- A: Wonβt help alone (props still change)
- C: For functions, not objects
- D: Incorrect β optimization exists
3. What happens if props are mutated inside a child?
Options:
A. React prevents mutation automatically B. Parent state updates C. Silent mutation causing bugs D. Component crashesβ Correct Answer: C
β Explanation:
- JS allows mutation β React doesnβt block it
- Leads to unexpected side effects
β Why others are wrong:
- A: No enforcement at runtime
- B: No automatic sync
- D: No crash unless used incorrectly
4. Why does this component re-render?
Options:
A. React.memo doesnβt work with functions B. Function is recreated each render C. Event handlers always trigger re-render D. Memo only works with stateβ Correct Answer: B
β Explanation:
- New function reference each render β fails shallow comparison
β Why others are wrong:
- A: Memo works fine with functions
- C: Events donβt trigger re-render by default
- D: Memo works with props
5. What is the best fix?
Options:
A. Move function outside component B. UseuseCallback
C. Use useEffect
D. No fix needed
β Correct Answer: B
β Explanation:
β Why others are wrong:
- A: May break access to state
- C: Irrelevant
- D: Incorrect
6. What will happen?
Options:
A. Renders empty B. Throws runtime error C. React warns but works D. React auto-fills propsβ Correct Answer: B
β Explanation:
useris undefined βuser.namecrashes
β Why others are wrong:
- A: No fallback
- C: No automatic handling
- D: React doesnβt infer props
7. What is the best fix?
Options:
A. Optional chaining B. Default props C. Both A and B D. Wrap in try-catchβ Correct Answer: C
β Explanation:
β Why others are wrong:
- A/B alone may not fully cover
- D: Overkill
8. What is the issue here?
Options:
A. Child wonβt update B. Child always re-renders C. Props cause memory leak D. Infinite loopβ Correct Answer: B
β Explanation:
- Parent state change β re-render β child re-renders
β Why others are wrong:
- A: Incorrect
- C/D: Not applicable
9. How to optimize the child?
Options:
A. React.memo B. useEffect C. useReducer D. useRefβ Correct Answer: A
10. What happens with prop drilling?
Options:
A. Improves performance B. Increases coupling C. Reduces bugs D. Avoids re-rendersβ Correct Answer: B
β Explanation:
- Intermediate components depend on props unnecessarily
11. Which is better for deeply nested data?
Options:
A. Props B. Context API C. Inline functions D. useEffectβ Correct Answer: B
12. What happens here?
Options:
A. Always re-renders B. Never re-renders C. Re-renders only if reference changes D. Crashesβ Correct Answer: C
13. What is wrong with this pattern?
Options:
A. Nothing B. Causes stale state issues C. Causes infinite loop D. Slows renderingβ Correct Answer: B
β Explanation:
- State wonβt update if prop changes
14. What is the better approach?
Options:
A. useEffect sync B. Derive directly from props C. Global state D. Ignore updatesβ Correct Answer: B
15. Why is children preferred over multiple props?
Options:
A. Faster rendering B. Avoids prop explosion C. Required by React D. Works only in class componentsβ Correct Answer: B
16. What happens here?
Options:
A. Props update only B. Component remounts C. No change D. Errorβ Correct Answer: B
β Explanation:
- Key change β React treats as new component
17. Which causes unnecessary re-renders?
Options:
A. Stable primitive props B. Inline objects/functions C. useMemo values D. Static propsβ Correct Answer: B
18. What is the main purpose of props?
Options:
A. Manage internal state B. Enable data flow and composition C. Replace hooks D. Optimize renderingβ Correct Answer: B
π Final Insight
These questions test:- Reference equality vs value equality
- Rendering behavior
- Component design decisions
- Performance optimization
π React Props β Real-World Coding Problems (Senior Level)
π§© Problem 1: Dynamic Profile Card System
π Problem Statement
Build a reusableProfileCard component that receives user data via props and renders different layouts based on user type.
π Constraints
- Props:
{ user, variant } variantcan be"compact"or"detailed"- Must not mutate props
β Expected Behavior
- Compact β name + avatar
- Detailed β name + avatar + bio + stats
β οΈ Edge Cases
- Missing user fields
- Unknown variant
π‘ Solution
π§ Explanation
- Uses default props to avoid crashes
- Conditional rendering based on props
π§© Problem 2: Controlled Form Input Wrapper
π Problem Statement
Create anInputField component that behaves as a controlled component via props.
π Constraints
- Props:
{ value, onChange } - Must not manage internal state
β Expected Behavior
- Value updates only via parent
β οΈ Edge Cases
- Undefined value
- onChange not passed
π‘ Solution
π§ Explanation
- Demonstrates controlled component via props
π§© Problem 3: Prevent Unnecessary Re-renders
π Problem Statement
Optimize aListItem component receiving object props.
π Constraints
- Must avoid unnecessary re-renders
β οΈ Edge Cases
- Parent re-renders frequently
π‘ Solution
π§ Explanation
- Combines React.memo + stable props
π§© Problem 4: Modal with Render Props
π Problem Statement
Build a modal that receives UI via a render prop.π Constraints
- Props:
{ render }
π‘ Solution
π§ Explanation
- Demonstrates render prop pattern
π§© Problem 5: Button with Behavior Injection
π Problem Statement
Create a reusable button that receives behavior via props.π‘ Solution
π§ Explanation
- Shows inversion of control
π§© Problem 6: Deep Prop Drilling Refactor
π Problem Statement
Refactor a deeply nested component passing props through 4 levels.π Constraints
- Avoid prop drilling
π‘ Solution
Use Context:π§ Explanation
- Avoids unnecessary prop passing
π§© Problem 7: Derived State Anti-pattern Fix
π Problem Statement
Fix component syncing state from props incorrectly.π‘ Solution
π§ Explanation
- Avoids stale state issues
π§© Problem 8: Safe Optional Props Rendering
π Problem Statement
Render optional nested data safely.π‘ Solution
π§© Problem 9: Generic Table Component
π Problem Statement
Build a table that receives columns and data via props.π Constraints
- Dynamic columns
π‘ Solution
π§© Problem 10: Prevent Function Prop Re-Creation
π Problem Statement
Optimize function props in a list.π‘ Solution
π§© Problem 11: Compound Component Pattern
π Problem Statement
Create aTabs system using props + children.
π‘ Solution
π§© Problem 12: Prop Validation with TypeScript
π Problem Statement
Ensure correct prop types.π‘ Solution
π§© Problem 13: Conditional Rendering Based on Props
π Problem Statement
Render loading or content.π‘ Solution
π§© Problem 14: Reusable Layout Wrapper
π Problem Statement
Create layout using children.π‘ Solution
π§© Problem 15: Key Prop Behavior
π Problem Statement
Explain remount behavior when key changes.π‘ Explanation
- Changing
keyforces remount β resets state
π§© Problem 16: Memoization Pitfall
π Problem Statement
Fix unnecessary re-renders with nested props.π‘ Solution
- Normalize props
- Avoid passing full objects
π§© Problem 17: Dynamic Theme Injection
π Problem Statement
Pass theme via props.π‘ Solution
π§© Problem 18: Higher-Order Component with Props
π Problem Statement
Wrap component and pass extra props.π‘ Solution
π§© Problem 19: Prop Normalization Layer
π Problem Statement
Normalize inconsistent API response props.π‘ Solution
π§© Problem 20: Performance Audit Scenario
π Problem Statement
Optimize a large list receiving props.π‘ Solution
- Use
React.memo - Virtualization (React Window)
- Stable props
π Final Takeaway
These problems test:- Real-world prop usage
- Performance optimization
- Architecture decisions
- Debugging mindset
π οΈ React Props β Senior-Level Debugging Challenges (Production Scenarios)
π§© 1. Infinite Re-render due to Derived State
β Buggy Code
π Whatβs Wrong
- Effect depends on
countbut setscountβ infinite loop
β WHY it happens
- Changing
counttriggers effect again β loop
β Fix
π§ Best Practice
- Avoid syncing props to state unless necessary
π§© 2. React.memo Not Working
β Buggy Code
π Whatβs Wrong
- Inline object causes new reference each render
β WHY
- Shallow comparison fails
β Fix
π§ Best Practice
- Stabilize object/array props
π§© 3. Unexpected Undefined Crash
β Buggy Code
π Whatβs Wrong
usermay be undefined
β WHY
- Props not guaranteed unless validated
β Fix
π§ Best Practice
- Always guard optional props
π§© 4. Function Prop Causing Re-renders
β Buggy Code
π Whatβs Wrong
- New function every render
β WHY
- Breaks memoization
β Fix
π§ Best Practice
- Use
useCallbackfor stable handlers
π§© 5. Prop Mutation Bug
β Buggy Code
π Whatβs Wrong
- Mutating props
β WHY
- Breaks Reactβs data flow
β Fix
π§ Best Practice
- Treat props as immutable
π§© 6. Stale Closure with Props
β Buggy Code
π Whatβs Wrong
delayis stale
β WHY
- Closure captures initial value
β Fix
π§ Best Practice
- Always include props in dependencies
π§© 7. Over-rendering Child Components
β Buggy Code
π Issue
- Child re-renders unnecessarily
β WHY
- No memoization
β Fix
π§ Best Practice
- Memoize pure components
π§© 8. Incorrect Key Causing State Reset
β Buggy Code
π Whatβs Wrong
- Index as key
β WHY
- Order changes β wrong reconciliation
β Fix
π§ Best Practice
- Use stable unique keys
π§© 9. Conditional Props Breaking UI
β Buggy Code
π Whatβs Wrong
- Passing string instead of boolean
β WHY
"true"is truthy but incorrect type
β Fix
π§© 10. Spreading Unnecessary Props
β Buggy Code
π Issue
- Passing unused props
β WHY
- Increases coupling, risk of bugs
β Fix
π§© 11. Breaking Controlled Component
β Buggy Code
π Issue
- Missing onChange
β WHY
- Becomes read-only
β Fix
π§© 12. Recomputing Expensive Props
β Buggy Code
π Issue
- Expensive computation every render
β WHY
- Function runs each render
β Fix
π§© 13. Nested Object Prop Issue
β Buggy Code
π Issue
- Deep object recreated
β WHY
- Breaks memo
β Fix
- Lift and memoize object
π§© 14. Children Misuse
β Buggy Code
π Issue
- Reassigning props
β Fix
π§© 15. Props Not Updating in Child
β Buggy Code
π Issue
- Not synced with prop changes
β Fix
- Use props directly OR sync via effect
π§© 16. Boolean Prop Misinterpretation
β Buggy Code
π Issue
- String is truthy
β Fix
π§© 17. Overusing Props Instead of Composition
β Buggy Code
π Issue
- Rigid API
β Fix
π§© 18. Missing Dependency Causing Buggy UI
β Buggy Code
π Issue
- Doesnβt react to prop change
β Fix
π Final Takeaway
These bugs reflect real production issues:- Reference equality pitfalls
- Stale closures
- Improper memoization
- Incorrect assumptions about props
ποΈ React Props β Real-World Machine Coding Problems (Senior / Architect Level)
These are production-grade problems designed to test:- Component architecture
- Data flow via props
- Performance & scalability
- Real-world trade-offs
π§© 1. Configurable Data Table (Enterprise Grid)
π Requirements
-
Render dynamic table using props:
columns,data,renderCell,sortConfig
-
Support:
- Sorting
- Custom cell rendering
- Column visibility toggle
π₯οΈ UI Behavior
- Click column header β sort
- Toggle columns β hide/show instantly
π Data Flow
- Parent owns data & sorting state
- Table receives everything via props
β οΈ Edge Cases
- Empty data
- Missing keys
- Large datasets
β‘ Performance
- Virtualization (react-window)
- Memoized rows
ποΈ Architecture
TableTableRowTableCell
π§ Approach
- Normalize columns
- Pass render functions as props
- Memoize rows
π§© 2. Headless Modal System
π Requirements
-
Build a modal with:
isOpen,onClose,children
- No styling (headless)
π₯οΈ UI Behavior
- Close on overlay click / ESC
π Data Flow
- Parent controls open/close
β οΈ Edge Cases
- Multiple modals
- Focus trap
β‘ Performance
- Lazy mount/unmount
ποΈ Architecture
ModalPortal
π§ Approach
- Use
childrenfor flexibility - Use props for behavior injection
π§© 3. Multi-Step Form Wizard
π Requirements
-
Steps passed as props:
steps,currentStep,onNext,onBack
π₯οΈ UI Behavior
- Navigate steps
- Validate before next
π Data Flow
- Central form state in parent
β οΈ Edge Cases
- Skip steps
- Validation errors
β‘ Performance
- Avoid re-rendering all steps
ποΈ Architecture
WizardStep
π§ Approach
- Render active step only
- Pass handlers via props
π§© 4. Reusable Dropdown with Custom Rendering
π Requirements
-
Props:
options,renderOption,onSelect
π₯οΈ UI Behavior
- Keyboard navigation
- Custom UI per option
β οΈ Edge Cases
- Empty list
- Duplicate values
β‘ Performance
- Debounced filtering
π§ Approach
- Render prop for flexibility
π§© 5. Infinite Scroll Feed
π Requirements
-
Props:
fetchData,renderItem
π₯οΈ UI Behavior
- Load more on scroll
π Data Flow
- Parent handles API
β οΈ Edge Cases
- Duplicate fetch
- End of list
β‘ Performance
- Intersection Observer
π§ Approach
- Controlled via props
π§© 6. Theme System (Dynamic Styling)
π Requirements
- Pass theme via props
- Support light/dark
β οΈ Edge Cases
- Missing theme keys
β‘ Performance
- Memoize theme object
π§ Approach
- Theme provider or prop drilling trade-off
π§© 7. Form Builder (Schema-driven UI)
π Requirements
-
Props:
schema,onSubmit
π₯οΈ UI Behavior
- Dynamically render inputs
β οΈ Edge Cases
- Unknown field types
β‘ Performance
- Lazy render sections
π§ Approach
- Map schema β components
π§© 8. Drag & Drop List
π Requirements
-
Props:
items,onReorder
β οΈ Edge Cases
- Rapid drag events
β‘ Performance
- Avoid full list re-render
π§ Approach
- Stable keys
- Memoized items
π§© 9. Notification System
π Requirements
-
Props:
notifications,onDismiss
π₯οΈ UI Behavior
- Auto-dismiss
β οΈ Edge Cases
- Duplicate notifications
π§ Approach
- Controlled list via props
π§© 10. Search with Debounced Input
π Requirements
-
Props:
onSearch
β‘ Performance
- Debounce input
π§© 11. Reusable Card System (Composable UI)
π Requirements
- Use
childrenfor layout slots
π§ Approach
- Composition over props explosion
π§© 12. Chart Wrapper (Reusable Visualization)
π Requirements
-
Props:
data,config
β οΈ Edge Cases
- Empty dataset
β‘ Performance
- Memoized transformations
π§© 13. Permission-based Rendering
π Requirements
-
Props:
permissions,children
π§ Approach
π§© 14. Lazy Image Component
π Requirements
-
Props:
src,placeholder
β‘ Performance
- Intersection Observer
π§© 15. File Upload Component
π Requirements
-
Props:
onUpload,accept
β οΈ Edge Cases
- Invalid file types
π§© 16. Pagination Component
π Requirements
-
Props:
page,totalPages,onChange
π§© 17. Headless Tooltip System
π Requirements
-
Props:
content,children
π§© 18. Virtualized List
π Requirements
-
Props:
items,rowHeight
β‘ Performance
- Render visible rows only
π§© 19. Undo/Redo System
π Requirements
-
Props:
state,onUndo,onRedo
π§© 20. Live Collaborative Cursor Tracker
π Requirements
-
Props:
users,positions
β οΈ Edge Cases
- Rapid updates
β‘ Performance
- Throttle updates
π Final Architect Insight
These problems test:- Prop-driven architecture
- Component composition vs configuration
- Performance tuning
- Scalable design patterns
π React Props β FAANG-Level Interview Questions (Senior Depth)
1. How would you design a component API using props for long-term scalability?
π Follow-up
- How do you prevent prop explosion?
- When would you switch to composition?
β Strong Answer
- Start with minimal, explicit props
- Prefer composition (
children) over configuration - Group related props into objects when needed
- Design for extensibility without breaking changes
WHY:
- Reduces coupling
- Improves flexibility
β Weak Answer
- βJust add more props as neededβ π Fails because it ignores scalability and API design
2. Explain how React decides whether to re-render a component based on props.
π Follow-up
- How does
React.memochange this? - What are its limitations?
β Strong Answer
- By default, React re-renders when parent renders
React.memodoes shallow comparison of props
Key Insight:
- Reference equality matters
β Weak Answer
- βReact only re-renders when props changeβ π Incorrect β parent re-render triggers child too
3. You notice a component re-rendering frequently despite unchanged data. How do you debug it?
π Follow-up
- What tools would you use?
β Strong Answer
-
Check:
- Inline objects/functions
- Parent re-renders
- Missing memoization
-
Use:
- React DevTools Profiler
β Weak Answer
- βAdd React.memo everywhereβ π Over-optimization without understanding cause
4. When would you avoid passing an object as a prop?
π Follow-up
- When is it acceptable?
β Strong Answer
-
Avoid when:
- Object recreated each render
- Component is memoized
-
Acceptable when:
- Stable reference (
useMemo) - Small apps
- Stable reference (
β Weak Answer
- βObjects are always badβ π Oversimplification
5. Design a reusable table component. What props would you expose?
π Follow-up
- How do you support custom rendering?
β Strong Answer
-
Props:
data,columns,renderCell
- Use render props for flexibility
β Weak Answer
- βJust pass data and map itβ π Not scalable or flexible
6. How do you handle deeply nested data without prop drilling?
π Follow-up
- Trade-offs of Context API?
β Strong Answer
- Use Context for global/shared data
- Avoid overuse (causes re-renders)
β Weak Answer
- βAlways use Contextβ π Ignores trade-offs
7. What are the risks of syncing props to state?
π Follow-up
- When is it justified?
β Strong Answer
-
Risks:
- Stale state
- Sync bugs
-
Use only for:
- Derived/controlled transformations
β Weak Answer
- βItβs fine to copy props into stateβ π Leads to bugs
8. How would you design a component that allows behavior injection?
π Follow-up
- Compare with HOCs
β Strong Answer
- Use function props (callbacks)
β Weak Answer
- βHardcode logicβ π Not reusable
9. Why does this cause unnecessary re-renders?
π Follow-up
- How do you fix it?
β Strong Answer
- New object reference each render
β Weak Answer
- βReact is inefficientβ π Misunderstanding core behavior
10. How do you decide between props vs global state?
π Follow-up
- What are scaling concerns?
β Strong Answer
-
Props:
- Local, predictable
-
Global state:
- Shared, complex
β Weak Answer
- βUse Redux for everythingβ π Overengineering
11. What is the role of children in API design?
π Follow-up
- When not to use it?
β Strong Answer
- Enables composition
- Avoids rigid APIs
β Weak Answer
- βItβs just for nestingβ π Misses design importance
12. A component is slow due to heavy prop computation. How do you optimize?
π Follow-up
- Trade-offs of memoization?
β Strong Answer
- Use
useMemo - Move computation outside render
β Weak Answer
- βUse useEffectβ π Wrong tool
13. Explain how prop changes trigger effects.
π Follow-up
- What if dependency is missing?
β Strong Answer
useEffectruns when dependencies change
β Weak Answer
- βEffects run on every renderβ π Incorrect
14. How would you design a headless component using props?
π Follow-up
- Why is this pattern useful?
β Strong Answer
- Logic via props, UI via children
β Weak Answer
- βJust build UI directlyβ π Not reusable
15. How do you prevent unnecessary prop spreading?
π Follow-up
- When is spreading useful?
β Strong Answer
- Explicit props preferred
- Spread only for wrappers
β Weak Answer
- βAlways use spreadβ π Risky
16. What happens when a key changes but props donβt?
π Follow-up
- Real-world use case?
β Strong Answer
- Component remounts β state reset
β Weak Answer
- βNothing changesβ π Incorrect
17. How do you handle optional props in large systems?
π Follow-up
- Type safety strategies?
β Strong Answer
- Default values
- TypeScript
β Weak Answer
- βJust check manuallyβ π Not scalable
18. Describe a real-world bug caused by props and how youβd fix it.
π Follow-up
- How to prevent it?
β Strong Answer
-
Example:
- Inline object β re-render loop
-
Fix:
- Memoization
β Weak Answer
- βIβd debug in consoleβ π Lacks depth
19. How would you audit a large app for prop-related performance issues?
π Follow-up
- Metrics youβd track?
β Strong Answer
- Use Profiler
-
Check:
- Re-render frequency
- Prop stability
β Weak Answer
- βRewrite everythingβ π Unrealistic
π Final Interview Insight
At FAANG level, props questions test:- Architectural thinking
- Trade-offs (simplicity vs scalability)
- Performance awareness
- Debugging intuition