Twig Components
Twig components are reusable, encapsulated templates that allow for a Don't Repeat Yourself (DRY) approach to HTML.
Twig is a PHP templating language that, as most of our projects are PHP based, lends itself to getting used in conjunction with Drupal or Laravel. For building our frontend components we are using Twig.js, a pure JavaScript implementation of the Twig PHP templating language.
The reusability and encapsulation of the components allows us to define a component once and use it in multiple places across your website with different content. Their modularity makes the code more readable, maintainable, and keeps it organized. Each component is independent and changes to one do not affect others.
Furthermore, components can be nested, allowing for a component to consist of other components. This forms a hierarchical structure, meaning smaller components can be combined to form larger segments of the user interface (UI).