Difficulty: 5/10hook return values, API design, stabilityReturn Values: Custom hooks should return values (state variables, functions, etc.) that the consuming component can use.Custom Hook for Fetching DataCopyScenario Questions0-2 years experience1You're writing a simple custom hook that fetches data on mount. What should the hook return so the component can use the data and loading state?2If you need to expose a ref to a child component via a custom hook, how would you structure the return value?2-5 years experience1Your team added a custom hook that returns an object with several callbacks, but the component re-renders on every render. What might be wrong with what the hook returns, and how would you fix it?Follow-up QuestionsCan you explain why returning a new object each render matters?How would you test that the hook’s return values are stable?What impact does the choice of return type have on TypeScript inference?Suggest Improvement