aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2023-07-10 23:11:32 +0100
committerGitHub <noreply@github.com>2023-07-10 23:11:32 +0100
commitf350db196bcab490b8a6b67f9536f0b9b7322073 (patch)
tree59664ca671be2cfdb473424ca1bf737cf12622e8 /README.md
parent6d314230346336ba5b452b1df39b908ffa666f45 (diff)
downloadlustre-f350db196bcab490b8a6b67f9536f0b9b7322073.tar.gz
lustre-f350db196bcab490b8a6b67f9536f0b9b7322073.zip
♻️ Replace React with diffhtml (#10)
* :wrench: Remove react dependency, add vite for running examples. * :heavy_plus_sign: Update stdlib version to 0.29 * :fire: Remove old examples. * :sparkles: Vendor diffhtml and update runtime ffi code to replace react. * :recycle: Refactor all the things now react is gone. * :memo: Remove references to react in the readme. * :sparkles: Create a simple counter example.
Diffstat (limited to 'README.md')
-rw-r--r--README.md49
1 files changed, 17 insertions, 32 deletions
diff --git a/README.md b/README.md
index 1373acb..b6d111c 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Lustre
-A framework for building create web apps – powered by Gleam and React!
+An Elm-inspired framework for building web apps in Gleam!
---
@@ -15,19 +15,25 @@ import lustre/event.{on_click}
import lustre/cmd
pub fn main() {
- let app = lustre.application(#(0, cmd.none()), update, render)
- lustre.start(app, "#app")
+ let app = lustre.simple(init, update, render)
+ let assert Ok(_) = lustre.start(app, "#app")
+
+ Nil
+}
+
+fn init() {
+ 0
}
-pub type Action {
+type Msg {
Incr
Decr
}
-fn update(state, action) {
- case action {
- Incr -> #(state + 1, cmd.none())
- Decr -> #(state - 1, cmd.none())
+fn update(state, msg) {
+ case msg {
+ Incr -> state + 1
+ Decr -> state - 1
}
}
@@ -52,30 +58,9 @@ the browser. **It will not work if your are targetting Node.js or Erlang.**
## Installation
-If available on Hex, this package can be added to your Gleam project:
-
-```sh
-gleam add lustre
-```
-
-and its documentation can be found at <https://hexdocs.pm/lustre>. You will also
-need to install `react` and `react-dom` from npm:
+Lustre is available on [Hex](https://hex.pm/packages/lustre). You can install
+it like any other Hex package:
```sh
-npm i react react-dom
+$ gleam add lustre
```
-
----
-
-## Development
-
-First, make sure you have both Gleam and Node.js installed, then:
-
-```bash
-npm i
-npm start
-```
-
-This sets up `chokidar` to watch our gleam source code and runs the compiler
-whenever we make a change. It also starts a server that will serve the examples
-located in `test/example/`.