A switch is a device that enables computers connected to it to share a network. There are also high-end switches that can be configured with different networks. The characteristic of the switch is that each port has the same independent bandwidth. For example, if you are a 100M switch, the bandwidth of each interface is also 100M.
The hub has the same function as a switch, except that all interfaces share a bandwidth, such as 10M hub. If there are five computers connected to it, each computer can only be allocated a bandwidth of 2M, thus eliminating the hub.