Check valves, also known as one-way valves, make sure that water only goes in one direction. There are 2 styles, spring and swing.
A spring loaded valve relies on a spring to keep the valve closed until there is a flow of water that then pushes the valve open. If water tries to flow from the other direction, the valve closes.
A swing check valve, also called a “flapper”, has a flap that sits on a pin. When water flows through the valve in the proper direction, the flap simply flips up and out of the way. If the flow of water is shut off, gravity pulls the flap back down.