-
Notifications
You must be signed in to change notification settings - Fork 303
Creating a Page
Yash Thakur edited this page Oct 7, 2017
·
5 revisions
Add a component that you want in your page to be visible in:
app > components > hello > world.js
import React, { Component } from "react";
export default class HelloWorld extends Component {
render() {
return(
<div>Hello World</div>
);
}
}
You can replace the code with your own header and footer (optional).
import React, { Component } from "react";
export default class Layout extends Component {
render() {
return (
<div>
<div className="text-center">This is the header</div>
{this.props.children}
<div className="text-center">This is the footer</div>
</div>
);
}
}
Add the routes to: src > pages > hello-world.js in the following format and export them.
import HelloWorld from "../app/components/hello-world";
import DefaultLayout from "../app/components/layout"; //Optional
const routes = [
{
path: "/",
exact: true,
component: HelloWorld,
layout: DefaultLayout, //Optional
}
];
export default routes;
Add the page routes to src > routes.js
import { configureRoutes } from "./core/utils/bundler";
// routes
import * as HelloWorld from "./pages/hello-world";
export default configureRoutes([
HelloWorld,
]);
Powered by Atyantik Technologies Private Limited