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.


npm install ink react


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 () => {
	}, []);

	return <Text color="green">{counter} tests passed</Text>;

render(<Counter />);

#React #Ink #Homepage #Documentation #Downloads #React #Command #Line #Applications #News Fast Delivery

Leave a Comment

Your email address will not be published. Required fields are marked *