https://github.com/jongacnik/monoapp-react
monoapp plugin to use React as a view layer
https://github.com/jongacnik/monoapp-react
Last synced: about 1 year ago
JSON representation
monoapp plugin to use React as a view layer
- Host: GitHub
- URL: https://github.com/jongacnik/monoapp-react
- Owner: jongacnik
- Created: 2018-11-12T02:52:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-19T20:12:42.000Z (over 7 years ago)
- Last Synced: 2025-02-28T09:21:05.415Z (over 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 11
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# monoapp-react
[monoapp](https://github.com/jongacnik/monoapp) plugin to use [React](https://github.com/facebook/react) as a view layer
## Example
```js
var monoapp = require('monoapp')
var withReact = require('monoapp-react')
var app = monoapp()
app.use(withReact)
app.route('/', view)
app.mount('#app')
function MyComponent () {
return
Hello World
}
function view (state, emit) {
return (
)
}
```
## Component
An instance of `React.Component` extended with `monoapp` state and emit is included:
```js
var { Component } = require('monoapp-react')
class MyComponent extends Component {
render () {
console.log(this.global)
console.log(this.emit)
return
Hello World
}
}
```