Removing a Page / Component

Steps to remove undesired page from the App

Removing a page from the app is pretty straight-forward. You just remove the target folder from the code, and remove the routing associated with it. Also, if this folder or any of its child pages are imported in some other page, you need to remove those as well.

In some cases, there can be nested routing. Let's see an example of removing a nested routed page - Netflix Layout

  • Go to App.tsx file.

  • Check if the page you want to remove is a direct child of main routing, or is a nested routing child. In our case, Netflix layout is part of the Layouts folder. We see a LayoutIndex route in the App.tsx file. That means the Netflix page is not directly routed

  • Now, follow this route to find another routing file in Layouts folder. The file is called LayoutIndex.ts in our case

  • You will see your target route in this location. Select and delete it

  • Remove the import line for Netflix as well from this file. Also, check if Netflix page was imported in some other page, and remove that import and its usage as well

  • You should remove the Netflix code folder from the project as well, but you can choose to keep it if you think you'll need it in future

Steps to remove undesired component from the Ap‌p

Components do not have direct routes in routing files, but they are often imported in many different pages and/or components.

  • Locate the component folder in the project. Note the export variable name as this will be used for importing the component in other pages / components

In this case, we can see FirebaseContext and withFirebase as the export variables.

  • Do a global search of these variable names, and remove the imports from all the files

  • Along with the imports, you will have to remove all the features using these variables as well

  • You are free to delete the component folder or keep it in the project. Once the imports are removed, it won't affect remaining code