MCPcopy
hub / github.com/anthonyshort/deku / renderEntity

Function renderEntity

lib/render.js:193–200  ·  view source on GitHub ↗

* Render the entity and make sure it returns a node * * @param {Entity} entity * * @return {VirtualTree}

(entity)

Source from the content-addressed store, hash-verified

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

Callers 2

mountEntityFunction · 0.85
updateEntityFunction · 0.85

Calls 1

setStateFunction · 0.85

Tested by

no test coverage detected