微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ink

编程之家收集整理的这个编程导航主要介绍了ink编程之家,现在分享给大家,也给大家做个参考。

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);

}

componentwillUnmount() {

clearInterval(this.timer);

}

}

render(<Counter/>);

 

GitHub:https://github.com/vadimdemedes/ink

网站描述:React 打造的的交互命令行工具

ink

官方网站:

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。