Being a bit naive, making mistakes, and needing ramp-up time is to be expected, especially from a junior hire. You absolutely need to give time to correct that sort of thing, and firing fast is not a good move. Some of the best devs I've worked with needed a few months to ramp upbefore they hit full stride.
On the other hand if someone is dicking around instead of working, being insubordinate, refusing to try to improve, upsetting coworkers, etc., then you've got behavioral problems on your hands. And those are absolutely good reasons to fire if they persist beyond an initial stern warning.