What’s the best practice for screen navigation after invalid user input?

Consider an Angular app with many user inputs over screens A, B and C. Screen C needs valid inputs from A and B; B from A only; and A is independent. Suppose while on screen B the user enters invalid inputs.

Question: What navigation should I support for B in this case?

My current thinking is to disallow navigation to C due to data validity issues. But what about navigating back to B? On the one hand, there are no validity issues, and the user may want to look up screen A to help with screen B inputs. On the other hand, this would complicate the app's state management. An alternative is to disallow such navigation, possibly with an option to restore the last valid inputs at B. As I lack experience in UX, I'd appreciate answers to help me with this trade-off.