ink 介绍
对CLI做出反应。使用组件构建和测试CLI 输出 。?
安装
npm install ink react
用法
import react,{Component} from 'react';
import {render,Color} from 'ink';
class Counter extends Component {
constructor() {
super() ;
this.state = {
i: 0
};
}
render() {
return (
<Color green>
{this.state.i} tests passed
</Color>
);
}
componentDidMount() {
this.timer = setInterval(() => {
this.setState({
i: this.state.i + 1
});
},100);
}
componen twill Unmount() {
clearInterval(this.timer);
}
}
render(<Counter/>);
?
GitHub: https://github.com/vadimdemedes/ink
网站描述: React 打造的的交互命令行工具
ink官方网站
官方网站:
如果觉得 网站内容还不错,欢迎将 网站 推荐给程序员好友。
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did177116