MetalbolicX / vanrs

๐Ÿฆ VanRS: 1:1 bindings from ReScript to ๐ŸฆVanJS (an ultra-lightweight , zero-dependency , and unopinionated Reactive UI framework based on pure vanilla JavaScript and DOM without React/JSX)

Repository from Github https://github.comMetalbolicX/vanrsRepository from Github https://github.comMetalbolicX/vanrs

VanRS

VanRS Logo

VanRS provides bindings for VanJS, which is lightest, zero-dependency reactive UI framework in the JavaScript ecosystem. By taking the advantage of the strongly-typed system of the ReScript programming language.

Supported Versions:

VanJS ReScript

Features

  • Seamless integration of ReScript with VanJS.
  • Type-safe bindings for VanJS functionality.
  • Reactive UI components with minimal overhead.
  • Easy-to-use API for creating dynamic web applications.

๐Ÿš€ Quick Installation

1. Create a ReScript Application

First, create a new ReScript application using one of the following commands:

npm create rescript-app@latest

๐Ÿ“ Note: For more information on setting up a ReScript project, refer to the official ReScript documentation.

2. Install Dependencies

Add the required dependencies to your project:

npm i vanjs-core vanrs

3. Update Configuration rescript.json file

In your rescript.json file, add the following dependency:

{
  "bs-dependencies": ["vanrs"]
}

๐Ÿ™Œ Hello World Example

Here's a simple example of how to use VanRS to create a reactive UI component:

  1. Create a file named Main.res in your src folder.
  2. Add the following code to Main.res:
@val @scope("document") @return(nullable)
external getElementById: string => option<Dom.element> = "getElementById"

let root = switch getElementById("root") {
| Some(el) => el
| None => Exn.raiseError("Root element not found")
}

let hello: unit => Dom.element = () => {
  Van.Tag.make("div")
  ->Van.Tags.addChild(Text("Hello, World!"))
  ->Van.Tags.build
}

Van.add(root, [Dom(hello())])->ignore

๐Ÿ›  Build and Run

To build and run your ReScript application, see the Compile and Run section.

๐Ÿ“š Documentation

view - Documentation

โœ Do you want to learn more?

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Technologies used

VanJS
VanJS
ReScript
ReScript

License

Released under MIT by @MetalbolicX.

About

๐Ÿฆ VanRS: 1:1 bindings from ReScript to ๐ŸฆVanJS (an ultra-lightweight , zero-dependency , and unopinionated Reactive UI framework based on pure vanilla JavaScript and DOM without React/JSX)

License:MIT License


Languages

Language:ReScript 55.9%Language:JavaScript 41.3%Language:HTML 2.8%