https://github.com/italonascimento/lemni
A functional and reactive framework on top of React. Embrace asynchronicity!
https://github.com/italonascimento/lemni
functional react react-native reactive xstream
Last synced: 8 months ago
JSON representation
A functional and reactive framework on top of React. Embrace asynchronicity!
- Host: GitHub
- URL: https://github.com/italonascimento/lemni
- Owner: italonascimento
- License: mit
- Created: 2018-01-13T05:58:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T23:29:39.000Z (over 3 years ago)
- Last Synced: 2025-04-04T19:18:39.559Z (about 1 year ago)
- Topics: functional, react, react-native, reactive, xstream
- Language: TypeScript
- Homepage: http://italonascimento.github.io/lemni
- Size: 21.5 MB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lemni
Lemni allows us to implement React components and aplications in a **functional and reactive** way, making it much more natural to deal with the asynchronicity of interfaces, as well as isolating side effects away from the actual implementation.
## Installation
You may install Lemni through npm or Yarn:
```bash
npm i @lemni/core
# or
yarn add @lemni/core
```
## Hello World
Lemni creates conventional React components, fully compatible with the entire React ecosystem, including **React Native**.
```typescript
import ReactDOM from 'react-dom'
import { lemni } from 'lemni'
const HelloWorld = lemni(
sources => ({
view: (viewArgs) =>
Hello World
})
)
ReactDOM.render(
,
document.getElementById('app')
)
```
## Basic Component
```typescript
import { lemni } from 'lemni'
import xs from 'xstream'
const Incrementer = lemni(sources => {
const onIncrement = xs.Stream.create()
return {
initialState: {
count: 0,
},
stateReducer: onIncrement.mapTo(
state => ({
count: state.count + 1,
})
),
view: ({ state, emitter }) => (
Count: {state.count}
Increment
)
}
})
```
## Docs
To better understand the above example and to see what else Lemni is capable of, head to the docs:
https://italonascimento.github.io/lemni/
## License
MIT