This page in the documentation is about Appyx
Appyx is now in its
To access the
2.x-related pages please check the sidebar or go to:
Structuring your app navigation¶
As seen in Composable navigation, you can make
To achieve this, Appyx offers the
Node class as the structural element.
In many of the examples you'll see this panel as an illustration of a very simple
Node – it has some local state (id, colour, and a counter).
If you launch the sample app in the
:app module, you can also change its state (colour) by tapping it. Its counter is stepped automatically. This is to illustrate that it has its own state, persisted and restored.
You can think of a
Node as a standalone component with:
- Its own simplified lifecycle
- State restoration
- Business logic that's kept alive even when the view isn't added to the composition
- The ability to host generic Plugins to extract extra concerns without enforcing any particular architectural pattern
Parent nodes, child nodes¶
ParentNodes can have other
Nodes as children. This means you can represent your whole application as a tree of Appyx nodes.
You can go as granular or as high-level as it fits you. This allows to keep the complexity low in individual
Nodes by extracting responsibilities to children, as well as composing other components to build more complex functionality.
Nodes offer the structure –
NavModels add dynamism to it.
Read more in Composable navigation
Nodes have their own lifecycles, directly using the related classes of
Read more in Lifecycle
React to dynamically added child nodes in the tree: ChildAware API
A summary of Appyx's approach to structuring applications:
- Compose your app out of
Nodeswith their own lifecycles and state
- Navigation is local, composed of individual pieces of
- Navigation is stateful
- Navigation is unit-testable
- You're free to implement your own navigable components by utilising
- Avoid global navigation concerns, like shared modules needing to know about the application, or the application needing to know about all its possible modules