Applying for multiple lecturer posts in the UK

how should I react and what should I do if I get a positive response from B after I have accepted the offer from A

This should not happen except in very rare circumstances. The typical UK hiring timeline is the job is announced with a known interview date and an offer will be made within days (sometimes hours) of the interview. They would then expect you to verbally accept the offer within days and then ideally present you with a contract a day or so after that.

The conventional wisdom is that after getting the contract, you should withdraw your other applications. If you verbally commit to A, but A cannot generate a contract in a timely manner, then most people (but not necessarily the people at A) will understand if you accept another offer. I am not a huge believer in the conventional wisdom. A good job offer can be your job for the rest of your life and to turn down your dream job in your dream department at your dream university in your dream city with great resources and salary and a position for your partner for a job you do not want to do with crappy resources and salary in city you hate, in my opinion is not reasonable. To screw over a department because someone else offered you a step higher on the salary scale also does not seem reasonable. In other words, you need to use your judgment to decide what to do.