Difficulty: 5/10component composition, custom hooks, shared librariesThere are different ways in which we can build shareable code in react:1Hooks2Higher Order Components3Render Props4Component compositionScenario Questions0-2 years experience1How would you extract a button component so it can be used on two different pages without duplicating code?2If you create a custom hook for data fetching, where do you place the file and how do you import it in a component?3What happens if you import the same component using two different relative paths in a small React app?Follow-up QuestionsWhat trade‑offs did you consider when choosing that pattern?How would you test that the reusable piece works in all contexts?What impact does this have on bundle size or load performance?Suggest Improvement