Part 5/10:
Call: Invokes a function immediately with a specified
this
context and individual arguments.Apply: Similar to call, but takes arguments as an array.
Bind: Returns a new function with
this
set to a specified context without invoking it immediately.
Optimizing React Component Performance
Question 9: How would you optimize a React component's performance?
You can use React.memo()
for functional components, optimize re-renders with useCallback()
, avoid unnecessary state updates, and utilize useMemo()
for heavy computations.
React Hooks
Question 10: What are hooks in React and why are they useful?