Ink is a library that supports using React to build command-line applications—the same component-based UI building experience that React provides in the browser. It’s just that InK is geared towards command-line applications.
So Ink is actually a React renderer, which converts the React component tree into a string, and then outputs it to the terminal.
Install
npm install ink react
use
import React, {useState, useEffect} from 'react';
import {render, Text} from 'ink';
const Counter = () => {
const [counter, setCounter] = useState(0);
useEffect(() => {
const timer = setInterval(() => {
setCounter(previousCounter => previousCounter + 1);
}, 100);
return () => {
clearInterval(timer);
};
}, []);
return <Text color="green">{counter} tests passed</Text>;
};
render(<Counter />);
#React #Ink #Homepage #Documentation #Downloads #React #Command #Line #Applications #News Fast Delivery