Instruction: Explain with examples how to type functional and class components in React using TypeScript.
Context: Tests the candidate's knowledge in integrating TypeScript with React, including typing props, state, and event handlers to enhance component development with type safety.