Skip to content

jongacnik/monoapp-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

monoapp-react

monoapp plugin to use React as a view layer

Example

var monoapp = require('monoapp')
var withReact = require('monoapp-react')

var app = monoapp()

app.use(withReact)
app.route('/', view)
app.mount('#app')

function MyComponent () {
  return <div>Hello World</div>
}

function view (state, emit) {
  return (
    <main>
      <MyComponent />
    </main>
  ) 
}

Component

An instance of React.Component extended with monoapp state and emit is included:

var { Component } = require('monoapp-react')

class MyComponent extends Component {
  render () {
    console.log(this.global)
    console.log(this.emit)
    
    return <div>Hello World</div>
  }
}

About

monoapp plugin to use React as a view layer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •