'Multiple branch hosting on Github

I have a React app project which has 3 different environments for the development of new features - dev, staging, and prod. Is there some way I can have 3 different hosting in the same repo for the respective environments?

Current Approach: Currently I have 3 different repo - react-app-dev,react-app-staging, and react-app-prod and each repo are configured for hosting deployments using Github pages with a custom domain. The main issue with this approach is having 3 repo with almost the same code which just does not feels right and also the difficulty while feature migration from dev to staging or to prod as sometimes the git history differs in the repo.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source