Depending on the type and configuration of the engine, spinners will provide aerodynamic streamlining and direct airflow into the engine cowl area for engine cooling. In addition, they provide protection for the propeller hub which houses a series of gears and a piston used to move the propeller blades for the desired pitch. Although the hub is rather beefy, at the front of most US controllable prop pitch hubs is a big plug that holds in hydraulic fluid if the prop is hydraulically actuated. Sometimes dirt could get under this plug and cause the prop to leak. Some propellers are electric and there are components on the hub used for propeller de-icing, so a hub might be necessary, again it depends on the configuration of the aircraft. Designers will determine the need for propeller hubs, in the case of the P-47 putting a spinner (which usually has a mounting plate and required hardware) was probably seen as a waste of time since engines were changed out so often, most of the time the propeller is removed first, depending on manufacturer requirements. If you notice propellers used on the P-47 actually had a hub that was somewhat pointy, I guess they were attempting to streamline it...
In today's world some light aircraft use spinners but the manufacture may allow the aircraft to be operated without it.