An open API service indexing awesome lists of open source software.

https://github.com/rbndg/diffy-view


https://github.com/rbndg/diffy-view

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# Diffy View

A simple class to extend and make React like components for CLI

### Example

``` js
const DiffyView = require("diffy-view")

class View extends DiffyView {
render(){
return `Enter your name
${this.state.name || ""}
`
}
}

const view = new View({state:{}})

view.on("enter-key",()=>{
console.log("Enter key pressed")
view.setState({
name : this.state.input
})
})

view.on("update",(line)=>{
view.setState({
input:line
})
})

view.forceRender()
```

## Credit
[Diffy](https://github.com/mafintosh/diffy) by [Mafintosh](https://github.com/mafintosh)