21 deaths in a population of about 24 million given the 2 week incubation period seems just about statistically impossible, if there was any travel between Wuhan and Shang Hai during the initial outbreak.
One of my main take aways with COVID-19 is that it isn't particularly difficult to stop transmission chains, if there is political will and cooperation. And starting it early is key.
Shanghai started early a pretty strong voluntary lockdown. Businesses were ordered to close, except for food and drug stores and big box stores selling essentials. Mask wearing became obligatory and quickly you weren't allowed in to any store without wearing a mask and most would check your temp as well.
Volunteer guards were posted at entryways to alley communities and buildings. Noone was allowed in unless they were a resident or invited. Invitees had to have their temp checked, and their name, phone# and ID card # recorded for contact tracing purposes. Residents were allowed out whenever they wanted, masked, but there wasn't really anywhere to go. Subways and buses kept running to keep up appearances of normality and allow health care and food service workers to get to their essential jobs.
This went on for 9 weeks. Businesses closed. Everyone staying home mostly. Everyone wearing a mask in public. Regular temp checks to enter food stores and banks, etc. People not gathering and not interacting much, and masked when they did. Transmissions stopped. SH actually sent thousands of medical personnel to Wuhan and Hubei. The top hospital I'm familiar with sent 450 doctors and nurses to Wuhan for about 10 weeks. They erected a large billboard on the hospital grounds with each one's picture and name. This wouldn't have occurred if their was a big threat/outbreak in SH. While the full province-wide lockdown in Hubei did a lot to limit the spread and protect the rest of China.
When the re-opening started in SH it was gradual. The first couple weeks I went to the gym to play basketball, I had to get temp-checked and leave my name and Phone # for contact tracing purposes. In SH, schools just reopened last week, but only for the senior classes of high school and middle school, 3+ months after closing.
I
assume anyone who tested positive in SH had their phone records checked to find out where they've been to contract trace. Some cities, such as Hangzhou a few hours south had a mandatory curfew. Only one person per household was allowed out per day to food shop.
Shanghai's protective measures were thorough and complied with and the virus never caught much of a toehold here. I've felt pretty safe here and trusted the implemented measures. It's a respiratory virus much like the flu in terms of transmission. It's not that hard to stop given the right measures complied with.