lit-element-effect

1.0.2 • Public • Published

Effect hooks for Lit-Elements

Version Size vulnerabilities dependencies code quality Statements Branch Functions Lines

Two effect hooks, useOnce and useEffect, that can be used to trigger something only on first render, or when specific things change.

Installation

npm install lit-element-effect

Usage

@property()
prop: string | undefined;

render() {
    useOnce(this, () => {
        console.log("triggered once")
    })

    useEffect(this, () => {
        console.log("triggered each time this.prop changes.");
        console.log("Current Value: ", this.prop)
    }, [this.prop])
}

Readme

Keywords

none

Package Sidebar

Install

npm i lit-element-effect

Weekly Downloads

16

Version

1.0.2

License

ISC

Unpacked Size

37 kB

Total Files

41

Last publish

Collaborators

  • matkainer