How can I hide for example the admin panel in my react code

If I build a basic react app, then you could see every ui in the .js files. But what if I for example want to hide the Adminpanel from the javascript files? (so the API calls to the admin routes are hidden too) - how can I do that?
If you are on the facebook site you also cant see the adminpanel of facebook in the (client-) sourcecode.

You would create separate builds for the end user facing experience and admin dashboard. That might be difficult to achieve depending in your setup. Another option would be to have two physically separate applications. However, with that approach you will probably need to figure out a strategy to share some code between the two applications.

One approach could be refactoring shared code into independent, shared libraries. Much of this depends on where you are it in the development process. Are you building something brand new from scratch or do you have an existing application that now needs a completely separate admin experience. It also depends on your familiarity with build systems, mono repos, micro-frontends, and shared libraries. All in relation to your chosen framework react because each of those concepts implementation can greatly differ across different frameworks and setups.

I’m not proficient with react since I’ve never built a production app with it. I have built and maintained several Angular projects. In Angular I would probably create a new project in the existing repository and separate any shared resources into shared libraries. Once that’s is done refactor any existing code to use the shared library code. Angular provides many pre-established processes to achieve things like this. I’m not so sure about react or its ecosystem because react is more of a library than a platform unless you piece together packages from the react ecosystem.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.