* Render the entity and make sure it returns a node * * @param {Entity} entity * * @return {VirtualTree}
(entity)
| 191 | */ |
| 192 | |
| 193 | function renderEntity (entity) { |
| 194 | var component = entity.component |
| 195 | var fn = typeof component === 'function' ? component : component.render |
| 196 | if (!fn) throw new Error('Component needs a render function') |
| 197 | var result = fn(entity.context, setState(entity)) |
| 198 | if (!result) throw new Error('Render function must return an element.') |
| 199 | return result |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Whenever setState or setProps is called, we mark the entity |
no test coverage detected