For the complete documentation index, see llms.txt. This page is also available as Markdown.

rw.setProps

The rw.setProps() function passes data from your hook to your templates. Any data passed becomes available as template variables.

Syntax

rw.setProps({
    key: value,
    anotherKey: anotherValue
});

Basic Examples

Simple Values

const transformHook = (rw) => {
    rw.setProps({
        message: 'Hello, World!',
        count: 42,
        isVisible: true
    });
};

exports.transformHook = transformHook;

In templates:

Arrays

In templates:

Objects

In templates:

Common Patterns

Passing Transformed Props

Conditional Values

Spreading Collections

Building CSS Classes

Multiple Calls

You can call setProps multiple times. Properties are merged:

Passing Context Objects

Last updated

Was this helpful?