childNodes : List of nodes that do not belong to the webcomponent render.
2.
update: Callback that forces a new childNodes scan.
Example
1
functioncomponent(){
2
const[childNodes]=useChildNodes();
3
return(
4
<host>
5
{childNodes
6
.filter((node)=> node.localName =="h1")
7
.map((Title)=>(
8
<Titleonclick={()=> console.log("click h1!")}/>
9
))}
10
</host>
11
);
12
}
Copied!
From the example we can highlight that the webcomponent will use all the children not created by the h1 type and will associate the onclick handler with them.