Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 724 Bytes

view.md

File metadata and controls

28 lines (23 loc) · 724 Bytes

View

View is a function in Component class that returns Hyperscript/JSX nodes, DOM Nodes, Component or Array of these three.

this.view() {
  return <h1>Hello World</h1>
}
this.view() {
  return <MyComponent />
}
this.view() {
  return [
    <h1></h1>,
    <MyComponent>,
    document.getElementById('foo')
  ]
}

View is rendered only once when Component is mounted or re-mounted. This is where Radi differs from other frameworks - it doesn't re render whole view, instead it uses Listener to re-render only necessary parts of DOM. So if you write logic inside view method before return statement, it will NOT be triggered every time something updates.