Passing data to templates
To send data to your templates, you can utilise the rw.setProps() method. By passing an object to this method, you are able to dynamically inject data into your templates.
Example 1: Simple Property Passing
const transformHook = (rw) => {
const message = 'Hello, World!';
rw.setProps({
greetingMessage: message
});
};
exports.transformHook = transformHook;Example 2: Conditional Logic for Display
const transformHook = (rw) => {
const { isVisible } = rw.props;
const display = isVisible ? 'visible' : 'hidden';
rw.setProps({
display
});
};
exports.transformHook = transformHook;Example 3: Basic Computation and Formatting
Example 4: String Manipulation
Example 5: Complex Calculation using collection data
Last updated
Was this helpful?

