choojs / choojs/nanocomponent

Call update on render when component is not in DOM

Open
#80 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
364
Forks
29
PR merge metrics
No merged PRs in 30d

Description

I was playing around with `nanocomponent` and `component-box` as possible target solution for jsx compilation and stumbled upon an issue.
Sometimes we may expect updaing a component state by calling `render`, even when the component is not in the DOM, eg.

```js
let menu = new Menu()

// these render calls do not incur update call
menu.render({ content: 'Home' })
menu.render({ content: ['A', 'B'] })

document.body.appendChild(menu.render())
```

Does it make any sense to invoke `update` even for detached components? We can imagine some components not dealing with DOM at all.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.