Every attribute a page writes has one role, and each role has its twin in JavaScript. Values come from one object model: the objects next.query() returns and events carry, with the same snake_case field names.
Every other attribute is a parameter of one of these, named after a field of the model: data-next-shipping-id="3" is shipping_id: 3, on an option and on an addItem button alike.
CODE
<span data-next-query="cart.total"></span>
CODE
await next.query('cart.total'); // 39next.on('cart.calculated', (cart) => cart.total); // the same Cart
New here? Start with the Quickstart, a whole page to copy, then the Recipes: one task per page, each example tested against the SDK.
Pages built with the earlier attributes keep working: see Legacy attributes.