https://github.com/slavahatnuke/ireactivity-example
https://github.com/slavahatnuke/ireactivity-example
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/slavahatnuke/ireactivity-example
- Owner: slavahatnuke
- Created: 2017-04-04T02:28:46.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-08T00:13:00.000Z (about 8 years ago)
- Last Synced: 2025-01-28T23:31:16.198Z (4 months ago)
- Language: HTML
- Size: 69.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# iReactivity example
This is example of iReactivity usage.
This is small app/example that change the name of app.
Details in: [./src/index.js](./src/index.js)
```jsx harmony
// src/index.jsimport React from 'react';
// main functions of iReactivity
import {Provider, connect, update} from 'ireactivity';// just an object
const store = { name: 'Hello' };// just a view of App
const AppView = ({name, onClick}) =>
;
{name}
// connected AppView to the store
const App = connect(AppView, {
name: (store) => store.name,
onClick: (store) => store.name += ' World'
});// rendering
ReactDOM.render(
,
document.getElementById('root')
);// if you need to update store
// outside of components
// for ex. socket.io
let timeout30s = 30*1000; // just for example
update(store, (store) => {
store.name = 'Something NEW!!!';
}, timeout30s);
```## How to start
- `npm install`
- `npm start`## iReactivity
[https://www.npmjs.com/package/ireactivity](https://www.npmjs.com/package/ireactivity) - Simple React binding