In the process of formation of a rainbow after a rain shower, sunlight is dispersed by tiny water droplets.
A rainbow is formed when it rains and there’s sunshine simultaneously.
Each raindrop is made of a different shape and has a different consistency as compared to a glass prism, still, it affects light in a similar fashion.
One can see the seven constituent colours (red, orange, yellow, green, blue, indigo and violet) when white light (sunlight) hits a collection of raindrops at a fairly low angle.
When the white sunlight travels from air into the drop of water, the constituent colours of light slow down to varying speed and frequencies.
When violet light enters the raindrop it bends at a relatively sharp angle.
Some of the light then passes back out into the air, and the rest is reflected back. Some of that reflected light passes out of the drop, bending as it moves back into the air again.
This way, each raindrop disperses the white sunlight into its constituent colours.