Flux is a very important part of soldering. Flux is necessary to reduce the oxides that tend to form whenever you have hot metals in contact with the air.
In electronics, we use a rosin-core solder or a mild solder or water-soluble solder. Make sure that you choose something that's not plumbing flux or acid-core flux, because that will tend to corrode the parts over time. It's okay for pipes but not for electronics.
So in this case, we're looking at rosin solder flux. It comes in a paste form. If the temperature's a little bit colder, it will tend to crystallize and solidify, but it can be melted with a little bit of heat from the soldering iron.
Now, when you heat flux it tends to produce smoke, so it's good to have some ventilation or some kind of vapor extractor to be sure that you're not breathing in a lot of the caustic vapors from the flux. What the flux does, when you heat a workpiece, is it reacts with these metal oxides that are forming with the temperature and exposure to the air, that tend to interfere with the metal-forming process of soldering. So this chemically reacts with these oxides, and makes for a nice, clean metal that can then form a nice, perfect alloy.
I should mention that many solders come with flux in the core. For example, this is flux-core solder. It's actually hollow, and inside there's a central core of flux. Then as you feed the solder into your workpiece, the flux then distributes itself over the surface of the work, and does its action in reducing those metal oxides, preventing them from occurring as you're doing the soldering. It happens to be at the right moment in time and place, so having a flux-core solder is often very, very helpful.
And finally, we should talk about water-soluble flux, which is a recent improvement in flux. With water-soluble flux, cleaning becomes much, much easier. With rosin-core flux, the flux is not water-soluble. It takes some kind of solvent in order to dissolve it and to remove it from the work piece. Solvents such as trichloroethylene and other toxic solvents must be used.
Water-soluble flux is definitely easier. It may not be appropriate in all circumstances. It can leave a residual layer that may interfere with high-impedance circuits, where you have resistances of ten megaohms or greater. The flux may actually lower that resistance and cause the circuit to malfunction. And on those cases you'd want to use a rosin-core solder flux. But in most cases, the water-soluble flux is the better choice. It's environmentally friendly and it's easier to clean when you're finished.