We appear to be heading toward a crisis over the president’s expected action on immigration. Luckily, the recent showdown over Obamacare provides ample lessons on how to react. Here are five things congressional Republicans should keep in mind:

1. You can be right on the issue and still lose the battle. Obamacare is bad policy and bad politics. Yet it keeps on ticking, despite the GOP’s best efforts to dismantle it. An executive order from President Barack Obama on immigration is likely to be bad politics and bad policy–but if Republicans don’t handle it correctly they will lose the PR battle.

2. The courts clarify things. It is far better to have the experts define whether something is constitutional or unconstitutional. Many Republicans (myself included) did not think that the 2010 Affordable Care Act passed legal muster, and it was useful to go through the courts to establish the act’s legality. Far preferable to the executive and legislative branches endlessly arguing about the legality of the president’s actions on immigration would be for the judicial branch to give us the necessary clarity.

3. You can’t beat something with nothing. Obamacare passed because Republicans didn’t offer an alternative. The health-care law won’t be replaced without an alternative. The same goes for immigration. Republicans can win only if they come up with a superior alternative that the president is compelled to sign.

4. Shutdowns don’t work. By shutting down the government, Republicans changed the subject from the deficiencies in the Obamacare rollout to the fact that the government was not open, which unhelpfully focused voter anger on the GOP. Republicans would be blamed if the government closes again–no matter how they try to slice it. They should avoid any strategy that leads to a shutdown.

5. Get general agreement on tactics. Even though the majority of them hated it, Republicans’ tactical reactions to Obamacare were all over the map: Sen. Ted Cruz was in one place, House and Senate leaders were in another, and the governors were largely somewhere else. Some governors decided to accept elements of the Medicaid changes, while others didn’t. That confusion led to internal bickering and confusion at the national level. Republicans need to coordinate their response to an executive order from the president if they hope to win the political fight in its aftermath.