Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 1774

Tilia is born... still early version, ideas welcome :-)

$
0
0

Hello everyone,

I just release @tilia/react (and @tilia/core).

It’s a little state management library (using JS Proxy) inspired by Overmindjs (Greetings to Christian).

The library is written in ReScript, has no external dependencies and works for both TypeScript and of course, ReScript.

I take this opportunity to thank everyone involved in ReScript for their great work with the language, the tooling, compilation, etc. It’s a lot of work to make my developper’s experience so simple and I’m very grateful that I could focus so much on my little project without thinking about anything else.

Usage example:

type counter = {mutable count: int, mutable timesten: int}

let c = Tilia.make({
  count: 4,
  timesten: 0,
})

Tilia.observe(c, c => {
  c.timesten = c.count * 10
})

@react.component
let make = () => {
  let c = Tilia.use(c)
  <div>
    <h1> {c.timesten->Int.toString->React.string} </h1>
    <Button onClick={_ => c.count = c.count + 1}>
      {React.string(`count is ${c.count->Int.toString}`)}
    </Button>
  </div>
}

Viewing all articles
Browse latest Browse all 1774

Trending Articles