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 through the guide.
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 views and controllers come in handy. They improve the manageability and modularity of your app, making it easier to organize and maintain.
Creating Your View
Let's begin by exploring Stratox's template system for creating dynamic views and components. Later on, we'll discuss controllers.
Let's proceed by creating a new template view file named src/templates/views/text.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 Views
Here are some important options to consider when loading and initializing views:
Static Views: These are views that are bundled and loaded synchronously with the application. They are commonly used for static content that does not change frequently. Read more
Asynchronous Views: Asynchronous views 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