Create a new page using React
In this tutorial, you will learn how to create a new page and seamlessly integrate it into the admin console using MagicJS framework.
Last updated
Was this helpful?
In this tutorial, you will learn how to create a new page and seamlessly integrate it into the admin console using MagicJS framework.
Last updated
Was this helpful?
Right-click on the main-features folder and choose 'New File'.
A feature in MagicJS represents a capability integrated into your application.
For e.g.: A 'newsfeed,' an 'Admin Dashboard,' or an 'authentication module' — each serves a distinctive feature within a social media project.
Select 'Blank UI/React Component' and give an appropriate name to the file and click Proceed.
We will name it 'about-page’.
You will get a boilerplate UI file containing the following snippet:
Go to the "Properties" tab and set the required path in the "Page URL".
We will set its path to '/about'.
Visit the specified path '/about'
in the browser to view the output.
Note that path routing configuration in the file app.json
was automatically done by mern.ai using the 'Page URL
' given in the Properties tab.
Mounting refers to assigning a specific location or path within an admin console or system to a particular page or functionality, facilitating easy navigation and access for authorized users.
Ensure the 'Starter Kit' feature is added. If not, add the 'Starter Kit' feature by asking the AI using
/add-template
tag.
We will mount a new page in the admin console that comes pre-installed with the Starter Kit.
Sign in to the web application to access the admin console.
We can easily mount a page in mern.ai with just a few clicks! Below are the steps for mern.ai as well as other IDEs.
Create a new UI file named 'products-page
' inside the main-features folder.
Change the "Hello World" to "Products" in the file as shown below:
Go to the properties tab.
Leave the path field empty as we are mounting this page in the admin console.
Add a mount target by clicking the + button.
Choose 'adminDashboard' from the select menu as the mount target.
Check the "Show link in sidebar" checkbox.
Set a suitable label, we will use: 'Products
'.
Give a link sort order, for example: '4
'.
Now, you'll find the 'Products
' page seamlessly integrated into the sidebar, complete with a clickable link in the admin console.
Go to
/admin
to view admin console.
That’s how you create a page in mern.ai using MagicJS framework.
That’s how you mount a page in mern.ai using MagicJS framework.