Instruction: Explain how to create and type a custom hook in React using TypeScript, providing code examples.
Context: Evaluates the candidate's proficiency in leveraging TypeScript within React applications, focusing on the creation and typing of custom hooks to encapsulate and reuse stateful logic.