That's one option.
However the issue with that is if you have multiple environments (e.g. three test environments, staging and production) and you want to have the code in a state of continuous deployment, then you use your branch for your feature, merge it in with this feature switch and when it gets to staging and you realise there's a bug, you can simply switch the feature off without it causing an issue rather than having to remove code from a merge.