Whenever you're ready, walk me through how you'd approach this.
How do you manage state in a complex frontend application, and which tools do you prefer? Explain how you separate local UI state, shared client state, and server state, and how your choice changes as the application grows. Discuss update flow, component subscriptions, side effects, persistence, and how you prevent unnecessary renders. Scope your answer to a modern React and TypeScript application; compare tools such as useState, useReducer, Context, Redux Toolkit, and TanStack Query.