Views

Gravity has a custom <View> component that serves two purposes:

  1. Houses global components that are common to all views (notification, modal)

When creating a new <Route>, your view component is passed to the render method and then rendered inside the ViewContext. This means that you can show a modal, create a banner notification or handle an error from anywhere in your application.

<PrivateRoute exact path='/signup' permission='user'
render={() => <View display={ Dashboard } layout='app'
title='Dashboard' />}/>

Creating New Views

To add a new view to your application, you add a new view file in the /client/src/views directory and create the <Route> in app.js.

Inside the views folder, you'll find a file called template.js that you can use to generate new views quickly, or use the CLI toolbelt.