Note: Jet.Js ia ALPA yet, can have any bugs. Found a bug, report Here.

Data Usage

Data is properties which you can use to manage you component. It always should be an object, properties inside can be any(string, number, boolean, array, obtect).

Data creates component properties like:

//data property

data: {
item: ‘Lorem Ipsum’,
}

//created property
this.item

You can use data both inside component(recomended for not big data), or imported:

//inside component 
com({
    name: 'jt-tabs',
    data:{
        title: 'My Title',
        content: 'My content...',
    },
    tpl() {
        return html`
            <h1>{{title}}</h1>
            <p>{{content}}</p>
        `;
    },
});

//import if big file, or you can not import, but use in same file if it good for you
//data.js
export const data = {
        title: 'My Title',
        content: 'My content...',
        //can be a lot of propirties more..
    }
    
//app.js
import { data } from './data.js';

com({
    name: 'jt-tabs',
    data: data,
    tpl() {
        return html`
            <h1>{{title}}</h1>
            <p>{{content}}</p>
        `;
    },
});

Every component can have it’s own property data, even it has props.

Example

⚠️Note: This documentation is still being written and updated regularly. For now it rather short, but will be detailed and will be added more examples. Jet.js is in alpha, so features may change or improve quickly.
It’s recommended to subscribe for mailing list to be informed in time Click here