Skip to content

kachurun/riot-pure-props

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>

About

Riot helper for getting props in pure components

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published