Skip to content

combine node.render() + this.afterRender() ? #19

@yoshuawuyts

Description

@yoshuawuyts

From this.afterRender():

This method needs to be called when returning a constructed virtual tree.

If the method is mandatory, wouldn't it make sense to always run it internally? What are the use cases for not running this method?

const baseElement = require('base-element')
const html = require('virtual-dom')

const el = baseElement()

// I would prefer this:
el.render(data => html(`<div></div>`))

// over always typing this:
el.render(data => this.afterRender(html(`<div></div>`)))

I'm not sure how the internals are laid out, but passed in function is being bound it might simplify the code and possibly make the interface more resilient. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions