https://en.wikipedia.org/wiki/Duty_of_loyalty
It should be pretty obvious you can't compete with your employer. If you want to compete then quit. You can't steal their trade secrets even if it's off duty. There's lots of other things covered by the duty of loyalty concept and if you explore them they almost all make perfect sense. It easy to see how the world wouldn't function without it.
Of course, you're free to speak ill of your employer at any time. And they're free to fire you for anything they hear about.
It may be shortsighted of them to do so; with a good employer, you should be able to criticize in a productive way and work to change things. But that's not an issue of legality.
The user you replied to wrote: "Of course, you're free to speak ill of your employer at any time. And they're free to fire you for anything they hear about."
That's broadly how it is in France (there is obviously a threshold with regards to what you say)
Quick Google:
"Un salarié critiquant violemment la politique des dirigeants de son entreprise et dénigrant son employeur ainsi que d'autres salariés. Faute grave. (Chambre sociale, arrêt n° 10-16929 du 27 septembre 2011)"
Then when the case hits the courts the outcomes will be markedly different.