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

  1. Houses global components that are common to all views like notification and modal.

When creating a new route, the <View> component is automatically passed to the element prop of the Route component and wrapped around the custom view defined in the route.

This means that the View component is a wrapper around all of your UI views and can show a modal, create a banner notification or handle an error from anywhere in your application.

Creating New Views

To add a new view to your application, you add a new view file in the /client/src/views directory and add a new route.

You can also generate new views quickly using the toolbelt.

Last updated