A heartbeat is the absolute worst possible way to determine whether a pregnancy is viable or not.
The heart will go on beating even if it's removed completely from the body. Even if you dissect the heart, the sections of it will keep going. Single heart cells will continue to beat when removed from the rest of it.
That's why the heartbeat law is absolutely, hands down, the most іԁіоtic possible way to go about it.