A hub is “half duplex”, one port on the hub can be either sending or receiving to all the other ports on the hub. When one port tries to either send while another one is already sending, you get a “collision”. All pkts are sent to all ports, and are dropped by the ports that aren’t the intended destination. While not obsolete, it’s pretty inefficent to hook up more than 2 or 3 things to a hub. But a 4 port hub costs about $5 these days, so it has it’s advantages.
A switch, on the other hand, allows each port to send and receive at the same time. Also, the switch remembers which computers are connected to each port, and will therefore only send traffic for a certain computer to that particular computer. (So the other devices on the other ports don’t have to drop as many unwanted pkts.) A 4 port switch costs about $20.
A typical router will have some ports on the “lan” side and one port on the “wan” side. The idea is that traffic on the local side that’s intended to go to other computers on the local side will stay local (like a switch, the two ports talk directly to each other), while traffic to the internet will be “routed” through the wan port. The wan port would pick up an ip address form your provider, while the local computers would pick up an ip address from the router. That way your provider only has to give you a single ip address, and you can hook up as many devices as you want.