4

GitHub - estrelajs/estrela: Full Reactive Framework.

 2 years ago
source link: https://github.com/estrelajs/estrela
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Estrela - Full Reactive Framework

Estrela is a Javascript framework to develop reactive web apps.


Estrela is extremely easy to use, all the hard work is done by the babel plugin. There's no need for hooks like useState, useEffect and others.

To create a state variable, just declare it using the let keyword to specify that its value will change in the future.

The component function will be called just once, so you can call any side effect, like data fetching, direct in the function scope.

// main.tsx
import { onDestroy, render } from 'estrela';

function App() {
  let count = 0;

  const interval = setInterval(() => count++, 1000);

  onDestroy(() => clearInterval(interval));

  return <Count count={count} />;
}

function Count(props: { count: number }) {
  return <div>Count is {props.count}</div>;
}

render(<App />, document.getElementById('app')!);

Installation

Start a new Estrela project by running the following degit command:

$ npx degit estrelajs/template my-project-name
$ cd my-project-name

# using Yarn:
$ yarn
$ yarn dev

# or using NPM:
$ npm i
$ npm run dev

Documentation

Check the documentation for more information.

Examples

See it in action on this Todo App example. You can find source code for this example here.

Contributing

Estrela is open source and we appreciate issue reports and pull requests.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK