How do you manage global state in a complex single-page application, and what are the trade-offs of using Context API versus external state libraries?