<script src="https://cdn.jsdelivr.net/gh/lullaby6/html-fetch/html-fetch.js"></script>
The components are basically html files that you can call from the html-fetch
element with the src
attribute.
for example we have this file in the path /components/MyComponent.html
:
<div>
<h1>My Component</h1>
</div>
and in our html we would use the html-fetch
element and we would indicate the path through the src
attribute:
<html-fetch src="/components/MyComponent.html"/>
To set the properties of the components, do it through the attributes and you can get the property/attribute using {<attribute name>}
in your component
For example:
<html-fetch src="/components/Title.html" title="Game of Thrones"/>
Title
component:
<h1>{title}</h1>