1.0.125 • Published 2 years ago

mlassicjs v1.0.125

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

MlassicJS

Classic way of creating modern web applications with blazingly fats reactivity.

Lite weight solution for creating heavy production level web apps.

making web app with heavy web frameworks (like Reactjs) is not ideal. Especially when profermance is Important.

Mlassic is in beta carefull while using it bugs may appear.

Installation

  npm i mlassicjs

Usage

In the browser

  import { render } from "mlasssicjs";
  function App() {
    return <div>Hello World</div>;
  }
  root.render(<App />, document.body);

using Hooks

most important thing in a "reactive" web app.

  import { render, useState, useEffect } from "mlassicjs";

  const [ count, setCount ] = useState(0);

  useEffect(()=>{
    document.body.style.backgroundColor = ["#eee", "#262", "#635", "#ccc"][Math.abs(Math.random()*4)];
  }, count);

  function App(){
    return (
      <div>
        { count }
        <button type="button" onclick={()=>setCount(e=>e+1)}>Increase Count</button>
      </div>
    );
  };

  render(<App/>, document.body);

using Hooks with Callers

  import { render, useState, useEffect } from "mlassicjs";

  const [ count, setCount ] = useState(0);

  useEffect(()=>{
    document.body.style.backgroundColor = ["#eee", "#262", "#635", "#ccc"][Math.abs(Math.random()*4)];
  }, count);

  // remember " count " is a function here which return value with called.

  function App(){
    return (
      <div>
        Here counter multiplied with 3: { count.setCaller(e=>e*3) }
        Here counter in normal form: { count }
        <button type="button" onclick={()=>setCount(e=>e+1)}>Increase Count</button>
      </div>
    );
  };

  render(<App/>, document.body);

Documentation

Please refer to documentation for further information Also you can use mlassic-cli for ease.

Documentation

1.0.125

2 years ago

1.0.124

2 years ago

1.0.123

2 years ago

1.0.122

2 years ago

1.0.121

2 years ago

1.0.12

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago