Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
Compare
Choose a tag to compare
@szympajka szympajka released this 03 Feb 12:00
· 10 commits to master since this release

This release improves the way how custom function consumes params.

For now on, you don't have to pass either state or component to your custom functions. Take a look on example:

import { createComponent, patch, h } from '../src';

const app = createComponent({
  test(custom, state, component) {
    console.log(custom, state, component);
  },
  render(state, component) {
    // All the methods you define, will be placed under the items.
    // Why? It's just a convention we took 🤔
    component.items.test('hello');
    return h('div', 'hello');
  },
});

patch(document.getElementById('root'), app);

The state and component will always be available on the end of your params list 😁