Questions:
What is the use of useContext?
This question is asked by the interviewer to assess your data sharing capability across deeply nested components without prop-drilling.
Sample Answer:
This hook (useContext) allows to consume values from React Context directly in a functional component.
const value = useContext(TestContext);
This useContext helps to avoid passing props manually to each level of the component tree. General use cases wherein the useContext is used are like User Authentication, Theme Switching, etc.