4 ms·
Using JSX syntax allows you to consolidate all similar operations in a single call. matry-dom traverses the JSX you pass into a call, finds all leaf nodes, and
by danielvaughn 2y ago
Using JSX syntax allows you to consolidate all similar operations in a single call. matry-dom traverses the JSX you pass into a call, finds all leaf nodes, and performs the operation on each of them. So you could do this:
function onUserLogin(user) {
matry.replace(
<main id="root">
<img key="user-profile" src={user.profileImage} />
<aside>
Welcome, {user.name}
</aside>
</main>
)
}
In this example, the img and aside elements could be anywhere in the tree.