Replace an existing page
This article describes how to replace an existing page in the app.
Overview
This article describes how to replace an existing page in the app.
Replace an existing page
To replace an existing page, you need to create a new React component and add it to the app. To do this, follow these steps:
- Open the
<package-id>/pagesfolder or create a new one if it does not exist. - Create a new React component in the
pagesfolder. You can usepages/CustomPage.jsas a reference.const CustomPage = { title: 'Custom Page', blocks: [ { name: 'namespace/custom-block',// custom block name attributes: { title: 'Title from app', }, }, ], }; export default CustomPage;
You need to register the block in the blocks folder. For more information, see Add a new block.
-
Register the page in the
pages/index.jsfile. For example, to replace theproductDetailpage, you need to add the following code:import CustomPage from './customPage'; const pages = { 'productDetail': CustomPage, } export { pages } -
Import the page in the
<package-id>/index.jsfile.import {pages} from './pages/index';
Now the `productDetail` page is replaced with the `CustomPage` component.