Truncated abstract: The formation of a protostellar disc is a natural outcome during the star formation process. As gas in a molecular cloud core collapses under self-gravity, the angular momentum of the gas will slow its collapse on small scales and promote the formation of a protostellar disc. Although the angular momenta of dense star-forming cores remain to be fully characterized observationally, existing data indicates that typical cores have enough angular momenta to form relatively large, rotationally supported discs. However, molecular clouds are observed to be permeated by magnetic fields, which can strongly affect the evolution of angular momentum through magnetic braking. Indeed, in the ideal MHD limit, magnetic braking has been shown to be so efficient as to remove essentially all of the angular momentum of the material close to the forming star such that disc formation is suppressed. This is known as the magnetic braking catastrophe. The catastrophe must be averted in order for the all-important rotationally supported discs to appear, but when and how this happens remains debated. We review the resolutions proposed to date, with emphasis on misalignment, turbulence and especially non-ideal effects. The dissipative non-ideal effects weaken the magnetic field, and the dispersive term redirects it to promote or hinder disc formation. When self-consistently applying non-ideal processes, rotationally supported discs of at least tens of au form, thus preventing the magnetic braking catastrophe. The non-ideal processes are sensitive to the magnetic field strength, cosmic ray ionization rate, and gas and dust grain properties, thus a complete understanding of the host molecular cloud is required. Therefore, the properties of the host molecular cloud -- and especially its magnetic field -- cannot be ignored when numerically modelling the formation and evolution of protostellar discs.