Take care to avoid damaging wires which can sometimes have a short span making it more challenging to install a new housing.
Install recessed lighting junction box.
Remove the old light fixture and then remove the junction box in the ceiling above it.
If you have an existing light fixture that you are replacing disconnect it before you begin the process of how to wire recessed lights.
This rule is demonstrated nicely by wall switches receptacles and standard light fixtures all of.
Electrical codes generally require that all electrical devices and the wiring connections to those devices must be enclosed in an approved electrical box often known as a junction box this metal or plastic box includes a cover to protect the wiring within and protect you from the wiring.
When installing a recessed light fixture in the location of an existing light fixture you must remove the old fixture and disconnect and remove the wiring as well as the ceiling box.
It is often necessary to use a saw to cut the junction from the joist to which it is attached.