# First RJS Template

Create an `RJS` instance, define `data`/`event`/`when`, and trigger the next render with `renew()`.

## Create and Update

`RJS` renders a template once (no vDOM diffing) and lets you trigger the next render manually with `renew()`. See [Directive Parsing](/core-concepts-directives) for how the directive pipeline works.

```javascript
const app = "#app".RJS({
    data: {
        // Define data
    },
    event: {
        // Define event methods
    },
    when: {
        before_render: function () {
            // Runs before rendering; return false to cancel
        },
        rendered: function () {
            // Runs after rendering completes
        }
    }
});

// Update: only include the items to update; unmentioned items retain their initial values
app.renew({
    data: { /* ... */ },
    event: { /* ... */ },
    when: { /* ... */ }
});
```
