A hub is a networking device for connecting multiple nodes together on a network to share resources. When a hub receives a data from a connected device, it broadcast that data to all other connected devices regardless of which one ends up as the final destination. Bandwidth is split between all of the connected computers accordingly so if there are a lot of connected devices through the hub the less the bandwidth that is available for each computer, which means slower connection speeds.
Hub is of less or no use in modern networking design/implementation which is mainly replaced by switches.
a network switch is a computer networking device that connects devices on a network by using packet switching to receive process and forward data to the destination devices.
A network switch is a multi port network bridge that uses hardware address (also known as MAC Address) to process and forward data at the data link layer (layer 2) of the OSI model this type of switches are typically called layer 2 switches but there are other switches that can operate at layer 3 of the OSI model. The layer 3 switches due to their ability to function at the network link layer, they provide routing capability.
Switches connects other devices together in local area network and it is an intelligent device as it makes use of its MAC address table to determine where to send data out some professionals called it an intelligent hub.
In summary a switch is most commonly used as the network connection point for hosts in the local area network (LAN) in a hierarchical inter networking model and similar architectures, switches are also used deeper in the network to provide connections between the switches at the edge.
A router is a networking device that forwards data packets between computer networks. It basically connects local area network to a remote network or it could be local area network to the Internet. A router process received packets by reading the ip address of the destination, then compare the destination IP address with the routing table entry and determine the ultimate path to send out the packets.