3 ms·
Hmm, interesting. What advantages do you see of using JSX for querying over the old jQuery-style $("#id").append(...)? Did you consider doing something more lik
by gushogg-blake 2y ago
Hmm, interesting. What advantages do you see of using JSX for querying over the old jQuery-style $("#id").append(...)? Did you consider doing something more like that, but allowing JSX instead of HTML strings like it was done in jQuery?
- danielvaughn 2y agoUsing 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.