Skip to content

Components

Arthur Guiot edited this page May 12, 2018 · 2 revisions

What are components

Components are very tiny class. They are meant to live inside Groups, and render single elements.

How to use them:

Here is a small example:

class Component extends P.Component {
    render() {
        this.component.innerHTML = "Hello World 🌎!"
    }
}
class Group extends P.Group {
    init() {
        this.component = this.mountComponent(
            this.group.querySelector(".component"),
            Component
        )
    }
}

Clone this wiki locally