We'll create an example that is fully available and installable through the installation process. However, it's recommended that you begin without relying on existing examples, as this tutorial will guide you through building the example step by step.
Let us start with a minor example that we will improve upon throughout the guide.
Add Routes
Begin by updating the router file located at src/routes/app.js as follows:
There's nothing wrong with managing code this way. However, as the app grows larger, this approach can become challenging, particularly when the router file starts to become lengthy. This is where template layout views and controllers come in handy. They improve the manageability and modularity of your app, making it easier to organize and maintain.
Creating Your Page
Let's begin by exploring Stratox's template system for creating dynamic layout and block components. Later on, we'll discuss controllers.
Proceed by creating a new template layout file named src/templates/views/Start.js.
Note: You can reuse the same view multiple times within the same method, as explained in more detail in the views section.
Visit your browser to see the results.
Response Arguments
If you want to know more about the response arguments, then visit the Response Arguments page.
Template Layout
Here are some important options to consider when loading and initializing views:
Static Layouts: These are layouts that are bundled and loaded synchronously with the application. They are commonly used for static content that does not change frequently. Read more
Asynchronous Layouts: Asynchronous layouts are loaded dynamically when needed, which can help improve performance by reducing initial load times. They are useful for content that may change frequently or is not required immediately upon application startup. Read more