There is a certain learning curve that beginner bike riders must deal with as they become familiar with riding, and fixing a dropped chain is one of those things.
Here is a short video that outlines three different ways to fix a dropped chain – two of which can be done while still riding – and is an important lesson for beginner bike riders:
After it happens a few times, and you become more familiar with your bike, it’ll be easier to quickly (and cleanly) put your chain back on. Keep pedaling and be safe!