DEV Community

Cover image for Dative.JS Tutorial
Tobi
Tobi

Posted on

Dative.JS Tutorial

Introduction

DativeJs Is A Mordern Ui Javascript FrameWork

How Do I Use Dative.Js

First

Scaffold A Project

$ npx degit dativeJs/template my-app

# Install All The Dependencies
$ npm i
Enter fullscreen mode Exit fullscreen mode

That Command Should Create a template with Dative.JS There

File Structure Should Be Considered While Creating a New Component

my-app
|- src
   |- your-component
      |- your-component.dative.html // The Template
      |- your-component.dative.js // The Script
Enter fullscreen mode Exit fullscreen mode
  // your-component.dative.js
  import Dative from 'dativejs';
  import template from './your-component.dative.html';

  export let YourComponent = Dative.extend({
     template,
     // Other Options Goes Here
  })
Enter fullscreen mode Exit fullscreen mode

Then You Can Import it in the src/index.js

import { YourComponent } from './your-component/your-component.dative'

...

app.attach([
  ...,
  new YourComponent({
     el: '#your-component-id'
  })
])
Enter fullscreen mode Exit fullscreen mode

You Set

Check DativeJS Docs for more details

Thanks For Reading :)

Top comments (0)