riot-pure-props

    1.0.2 • Public • Published

    riot-pure-props

    Riot helper for getting props in pure components.

    Compatible with Riot.js 5

    NPM: https://www.npmjs.com/package/riot-pure-props


    Usage:

    Install from NPM:

    npm install riot-pure-props

    or copy file getProps.js to you own project.

    Usage example:

    <raw>
        <script> 
            import { pure } from 'riot;
            import getProps from 'riot-pure-props';
    
            export default pure(({ attributes, slots, props }) => {
                return {
                    mount(el, context) {
                        this.root = el;
                        this.props = getProps(this.root, context, attributes, props);
    
                        this.render();
                    },
    
                    update(context) {
                        this.props = getProps(this.root, context, attributes, props);
    
                        this.render();
                    },
    
                    render() {
                        this.root.innerHTML = this.props.content;
                    }
                }
            });
        </script>
    </raw>

    Install

    npm i riot-pure-props

    DownloadsWeekly Downloads

    1

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    4.18 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar