https://github.com/mariuslundgard/react-opstore
React bindings for opstore.
https://github.com/mariuslundgard/react-opstore
immutable-datastructures javascript react react-bindings state-management store
Last synced: about 1 month ago
JSON representation
React bindings for opstore.
- Host: GitHub
- URL: https://github.com/mariuslundgard/react-opstore
- Owner: mariuslundgard
- License: mit
- Created: 2017-04-09T17:56:34.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-02T12:26:57.000Z (over 8 years ago)
- Last Synced: 2025-05-13T15:19:22.513Z (about 1 year ago)
- Topics: immutable-datastructures, javascript, react, react-bindings, state-management, store
- Language: TypeScript
- Homepage:
- Size: 201 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-opstore
React bindings for [`opstore`](https://github.com/mariuslundgard/opstore).
```sh
npm install react-opstore
```
[](https://travis-ci.org/mariuslundgard/react-opstore)
[](https://coveralls.io/github/mariuslundgard/react-opstore?branch=master)
[](https://www.npmjs.com/package/react-opstore)
> DISCLAIMER: `react-opstore` is inspired by [`react-redux`](https://github.com/reactjs/react-redux).
## Usage
```js
import {connect, Provider} from 'react-opstore'
import {createStore} from 'opstore'
import React from 'react'
import {render} from 'react-dom'
const Counter = ({count}) => (
-
{count.get()}
+
)
const mapStoreToProps = store => ({
count: store.ref('count')
})
const ConnectedCounter = connect(mapStoreToProps)(Counter)
const store = createStore({count: 0})
render(
,
document.body
)
```
## License
MIT © [Marius Lundgård](https://mariuslundgard.com)