Difficulty: 5/10higher-order components, authentication flow, React contextjavascriptCopyScenario Questions0-2 years experience1We have a simple login page and a Dashboard component. How would you wrap Dashboard with a withAuthentication HOC so that only logged‑in users can see it?2If the authentication check inside the HOC is asynchronous, what would you render while waiting for the result?2-5 years experience1You added withAuthentication to several routes, but after a recent refactor the app crashes when a component receives undefined props. What could be wrong in your HOC implementation?Follow-up QuestionsHow would you test this HOC?What are the trade‑offs of using a HOC versus a hook for auth?How does this affect server‑side rendering?Suggest Improvement