Correct! Note though, that if you want to have that component to be linkable from the link sheet, you’ll need to use the rw.addAnchor(componentID); in your hooks.
That will make the component linkable from within the Anchor select menu when linking:
It’s a little bit more advanced, so here’s a full hooks.js file we use on a component, this also uses the rw.setRootElement() method (which needs better documentation, but does what you might expect):
const transformHook = (rw) => {
const { customID, classes } = rw.props;
// allows you to control the outermost
// HTML element for this component
rw.setRootElement({
as: "div", // could be nav, section, etc..
class: classes,
args: {
id: customID
},
});
// This makes the component linkable via
// the "Anchor" dropdown in Link sheets
if (customID.length > 0) {
rw.addAnchor(globalID);
}
rw.setProps({ classes });
};
exports.transformHook = transformHook;