I'm trying to create new pages and use them in the production build.
i added my page component
to the renderRoutes
file like this :
import React from 'react';
import { Switch, Route } from 'react-router-dom';
import { Page } from '@magento/peregrine';
import ErrorView from 'src/components/ErrorView/index';
import RoutesTypes from './authentication';
// components
import MyPage from 'src/components/MyPage';
const { PrivateRoute, GuestRoute } = RoutesTypes;
const renderRoutingError = props => <ErrorView {...props} />;
const renderRoutes = () => (
<Switch>
<Route
exact
name="profile"
staticName={true}
path="/account/profile.html"
component={MyPage}
/>
<Route render={() => <Page>{renderRoutingError}</Page>} />
</Switch>
);
export default renderRoutes;
and going to /account/profile.html
does fully work as intended, but while the page is loading, this shows up :
Is there a way to remove that not found
in the title
and body
while the page is loading?
componentDidMount() { document.title = 'Your Page Title'; }
to your <MyPage> component file, before the render method.