Prerequisites Overview
Here is the complete prerequisite checklist at a glance. Each item is explained in detail below with code examples and links to the relevant lessons:
| Prerequisite | Why OWL needs it | Status in JS course |
|---|---|---|
| ES6 Classes | Every OWL component is a class | ✅ Fully covered |
| ES6 Modules | OWL apps are structured as modules (import/export) |
✅ Fully covered |
| Arrow Functions | Used constantly in templates and event handlers | ✅ Fully covered |
| Destructuring | const { Component, mount, xml } = owl; |
✅ Fully covered |
| Template Literals | The xml`` helper uses a tagged template literal |
✅ Covered (strings) |
| Async / Await | Async lifecycle hooks (willStart, willUpdateProps) |
✅ Fully covered |
| DOM Basics | Understanding what OWL renders into | ✅ Fully covered |
Prototypes / this |
Class methods use this to access state and props |
✅ Covered (OOP) |
| HTML Basics | OWL templates are XML/HTML — you need to read and write tags | ⚠️ Not a dedicated ylearner course yet |
| CSS Basics | Styling OWL components — class attributes, selectors |
⚠️ Not a dedicated ylearner course yet |
A dedicated HTML and CSS course is planned for ylearner. In the meantime, you need basic HTML knowledge — understanding tags, attributes, nesting, and forms. If you can read and write simple HTML pages you are ready. You do not need advanced CSS for this course, but knowing basic selectors and properties helps when styling OWL components.
1. ES6 Classes
Why you need it: Every OWL component is an ES6 class that extends the built-in Component class. If you do not understand class syntax, inheritance, and this, OWL component code will be confusing from day one.
// You must understand this class syntax before OWL
class Animal {
constructor(name) {
this.name = name;
}
speak() {
return `${this.name} makes a sound.`;
}
}
class Dog extends Animal {
speak() {
return `${this.name} barks.`;
}
}
const dog = new Dog("Rex");
console.log(dog.speak()); // Rex barks.
// OWL uses exactly this pattern:
// class MyComponent extends Component { ... }
Key concepts you need: class declaration, constructor(), extends for inheritance, this keyword, instance methods, and static properties.
2. ES6 Modules (import / export)
Why you need it: OWL itself is a module. You import Component, mount, xml, and useState from the OWL library. Your own components will be split across multiple files using module syntax.
// Destructured import — used constantly with OWL
import { Component, mount, xml, useState } from "@odoo/owl";
// Exporting your component for use in other files
export class MyCounter extends Component {
state = useState({ count: 0 });
static template = xml`<div><t t-esc="state.count"/></div>`;
}
// Default export
export default class App extends Component { /* ... */ }
// In another file:
import App from "./App.js";
import { MyCounter } from "./MyCounter.js";
Key concepts: named exports, default exports, named imports, destructured imports, and file-relative import paths.
3. Arrow Functions
Why you need it: Arrow functions appear everywhere in OWL — inline event handlers in templates, array methods, and short callbacks. The template syntax t-on-click="() => state.count++" uses an arrow function directly inside an XML attribute value.
// Arrow functions — concise syntax
const add = (a, b) => a + b; // implicit return
const double = x => x * 2; // single param, no parens needed
const greet = () => "Hello!"; // no params
// Arrow functions in event handlers (very common in OWL templates):
// t-on-click="() => state.count++"
// t-on-click="(ev) => handleClick(ev)"
// Arrow functions vs regular functions — this binding
class Counter extends Component {
increment = () => {
// Arrow function — 'this' refers to the component instance
this.state.count++;
};
}
4. Destructuring and Spread
Why you need it: OWL is imported using object destructuring. Props objects are often destructured. The spread operator is used when working with OWL's reactive state objects.
// Object destructuring — used to import from OWL
const { Component, mount, xml, useState, onMounted } = owl;
// Destructuring props in component methods
class UserCard extends Component {
get displayName() {
const { firstName, lastName } = this.props;
return `${firstName} ${lastName}`;
}
}
// Array destructuring
const [first, second, ...rest] = [1, 2, 3, 4, 5];
// Spread — useful when creating new state objects
const newState = { ...oldState, count: oldState.count + 1 };
→ Learn Destructuring → | Learn Spread & Rest →
5. Template Literals
Why you need it: OWL templates are defined using the xml tagged template literal. Understanding how tagged template literals work helps you understand what the xml`` helper actually does (it compiles the XML string into a rendering function).
// Regular template literal (string interpolation)
const name = "Alice";
const greeting = `Hello, ${name}! You are ${2026 - 1995} years old.`;
// Tagged template literal — the xml`` helper in OWL uses this pattern
// The tag is a function that receives the template parts
function tag(strings, ...values) {
return strings.raw.join('');
}
const result = tag`Hello ${name}!`;
// In OWL:
static template = xml`
<div>
<h1>Hello, OWL!</h1>
</div>
`;
// xml is a function that compiles the XML template string into a template ID
6. Async / Await
Why you need it: OWL has async lifecycle hooks. The willStart hook (runs before a component first renders) is commonly used to fetch data from an Odoo RPC call or an external API. If you mark a lifecycle function async, OWL will wait for it to resolve before rendering the component. You must understand Promises and async/await to use this pattern correctly.
import { Component, xml, useState, onWillStart } from "@odoo/owl";
class UserList extends Component {
state = useState({ users: [], loading: true });
setup() {
// onWillStart runs before the first render — OWL awaits the Promise
onWillStart(async () => {
const response = await fetch("/api/users");
const data = await response.json();
this.state.users = data;
this.state.loading = false;
});
}
static template = xml`
<div>
<p t-if="state.loading">Loading...</p>
<ul t-else="">
<li t-foreach="state.users" t-as="user" t-key="user.id">
<t t-esc="user.name"/>
</li>
</ul>
</div>
`;
}
Key concepts: Promises, async functions, await, and error handling with try/catch.
→ Learn Async/Await → | Learn Promises →
7. DOM Manipulation Basics
Why you need it: OWL is a DOM framework — it renders components into the browser's Document Object Model. Understanding what the DOM is, how document.getElementById() works, and what it means to "mount" a component to a DOM node is essential context. You do not manipulate the DOM directly in OWL (OWL does it for you), but you must understand what is happening.
// DOM concepts you must understand before OWL:
// 1. Selecting elements
const root = document.getElementById("root");
const btn = document.querySelector(".my-button");
// 2. OWL mounts into a DOM element
// mount(MyApp, document.body); // Mounts to body
// mount(MyApp, document.getElementById("app")); // Mounts to #app
// 3. OWL creates, updates, and removes DOM nodes for you
// You never call document.createElement() or element.textContent
// inside OWL components — the template handles it declaratively.
→ Learn DOM Manipulation → | Learn DOM Events →
8. HTML Basics (Required — No Course Yet)
Why you need it: OWL templates are XML — essentially HTML with special t-* attributes. To write OWL templates you need to understand HTML tags, attributes, nesting rules, self-closing tags, and basic form elements (<input>, <select>, <textarea>).
A dedicated HTML and CSS course is in development for ylearner. In the meantime, if you don't know basic HTML, you should spend a few hours learning HTML tags before starting OWL. You need to be comfortable reading and writing simple HTML pages with headings, paragraphs, divs, buttons, and forms. The level needed is not advanced — just enough to understand what the XML template is producing.
The minimum HTML you need for OWL:
<!-- Block elements -->
<div class="container">
<h1>Title</h1>
<p>A paragraph of text.</p>
</div>
<!-- Inline elements -->
<span class="badge">New</span>
<strong>Bold text</strong>
<!-- Lists -->
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<!-- Form elements (important for t-model binding) -->
<input type="text" placeholder="Enter text" />
<select>
<option value="a">Option A</option>
<option value="b">Option B</option>
</select>
<textarea rows="4"></textarea>
<button type="button">Click me</button>
Quick Self-Assessment
Before starting the OWL JS course, try answering these questions. If most of them are easy, you are ready. If several are difficult, review the linked lessons first.
| Question | Covered in |
|---|---|
What does class Dog extends Animal mean? What is this inside a method? |
JS Classes |
What is the difference between export default and named export? |
Modules |
What does const { a, b } = obj; do? |
Destructuring |
What is the difference between function() {} and () => {} regarding this? |
Arrow Functions |
What does await fetch("/api") do? What is async function? |
Async/Await |
What is the DOM? What does document.getElementById("app") return? |
DOM |
Can you write a simple HTML page with a <div>, a <button>, and an <input>? |
HTML basics (external resource) |
If you already have experience with React, Vue, or Angular, you already know the component model concept. Your biggest adjustment will be OWL's XML template syntax (instead of JSX or SFC templates) and the class-based component structure. Skim the prerequisites and jump straight to the Getting Started lessons.
📋 Summary
- ES6 Classes — every OWL component is a class. Understand
class,extends,this, andstatic. - ES6 Modules — OWL and your components use
import/export. Required for any multi-file project. - Arrow Functions — used constantly in event handlers and template expressions.
- Destructuring —
const { Component, xml } = owl;is the first line of every OWL file. - Template Literals — the
xml``helper is a tagged template literal. - Async/Await — OWL lifecycle hooks can be async; data fetching before render uses
willStart. - DOM Basics — understand what OWL renders into, even though OWL manages the DOM for you.
- HTML Basics — OWL templates are XML/HTML; you must be comfortable reading and writing basic HTML.
- All JavaScript prerequisites are covered in the ylearner JavaScript course. An HTML/CSS course is coming.
Frequently Asked Questions
You can, but you will struggle. OWL components are classes — without understanding class syntax you will not know how to write a component. And without module syntax you cannot structure a multi-file project. The minimum is: classes, destructuring, and arrow functions. Without async/await you can still learn 80% of OWL — just skip the async lifecycle hook lessons until you learn it.
Basic HTML is enough — you need to read and write common tags: div, span, p, h1-h6, ul/li, button, input, select, form. You do not need to know advanced HTML like canvas, video, or web components. You also do not need deep CSS knowledge — just basic class usage.
No. OWL is written in TypeScript internally but works perfectly with plain JavaScript. This entire course uses JavaScript. TypeScript is optional — if you already know it, OWL's type definitions are excellent and give you great IDE autocompletion. If you don't know TypeScript, learn OWL in JavaScript first and add TypeScript later when you're comfortable.
If you know React you already understand all the JavaScript prerequisites — classes, modules, arrow functions, destructuring, async/await, and the DOM. Your adjustment will be OWL's template syntax (t-* directives in XML instead of JSX) and the class-based component model (instead of function components). You can skip most prerequisite lessons and jump straight to the OWL introduction.