A component class defines the behavior shared by frontend component instances. Each instance can own state, render a virtual DOM view, and control when that view enters or leaves the browser DOM. section 9.2
A practical component class separates several responsibilities:
- render() produces the virtual DOM for the specific component. section 9.2
Creating different component classes
defineComponent({ render }) acts as a factory: it creates a class whose render() method delegates to the supplied render function. CreateTodo and TodoList can therefore have different views, while each returned class can be instantiated repeatedly. Instance state can make otherwise similar instances render differently.
A component class can later become a parent as well as a view owner: subcomponents receive data through props, emit events upward, and clean up subscriptions during unmounting. section 11.0
