Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/robbestad/svenjs

A JavaScript framework for composable web apps
https://github.com/robbestad/svenjs

Last synced: 20 days ago
JSON representation

A JavaScript framework for composable web apps

Awesome Lists containing this project

README

        

# SvenJS

A JavaScript framework for composable web apps

# Demos

- [TodoMVC](http://svenanders.github.io/svenjs-todomvc/) ([Source](https://github.com/svenanders/svenjs-todomvc))

# Releases

- 2.0.2: ES modules, bug fixes and more!
- 0.3.2: Added *_beforeMount* life cycle method.
- 0.3.1: Added composition (importing components and referencing them in JSX by name). For instance: _const SecondComponent = require("SecondComponent")_. Referenced in _render_ like this: __
- 0.3.0: Renamed life cycle methods. New names: *_didMount* & *_didUpdate*

# Features

- Enforced state immutability

- Minimal file size

# Goals

- Can be used in a browser script tag (almost there)

- A web library that enables you to write code that can be accessed both serverside and clientside

- Built in store implementation (todo)

# Install

Use the npm version:

```bash
npm install svenjs
```

Build youself. Clone this repo and run

```bash
npm run build
```

# How to use

```html
import SvenJs from "svenjs";

SvenJs.create({
initialState: {
clicks: 0
},
render() {
const clickFunc = () =>{
let clicks=this.state.clicks;
this.setState({clicks: ++clicks });
}
return (


The Click App



Click me?


Click stats


You have clicked on the button {this.state.clicks} times



)
}
});
SvenJs.render(App, document.getElementById("app"))
```

## Related Modules

* [svenjsx](https://github.com/svenanders/svenjsx) - JSX as used by SvenJS.

* [svenjsx-loader](https://github.com/svenanders/svenjsx-loader) - Webpack loader for SvenJS.