Creating an App
Each app in BlueRain is essentially a React Compoent, that renders during system lifecycle.
Let's learn by building a Hello World app.
To create an app, we need to create a React Component and extend it from BlueRain's App
component.
Now let's create the main app component:
Notice that we also defined appName
and slug
static properties.
appName
defines the name of the app. This is a required property and not providing one will throw error when you register the app.slug
property defines the url slug for your app. In this case the app's url will be/app/hello-world
. If you don't give one, then BlueRain will automatically create a slug by kebab casing theappName
property. It's a good convention manually define theslug
.
You can define even more App properties. For a complete list, please refer to the API Reference.
Extending React's Component
It is also possible to extend the default React Component. You may do this if you don't wish to use extra helper methods that come in the App
class.
So the same app can be created as:
As a Stateless Functional Component
Since each app is just a React Component, it is also possible to create an app as a stateless functional component.
Routes
Since BlueRain uses React Router 4, each app can add it's own routes.
Last updated