
Ink Has a Free React for CLIs — Here's How to Use It
Building interactive CLI tools with raw stdin/stdout is painful. Ink lets you build CLI apps using React components — useState, useEffect, flexbox layout — all in the terminal. What Is Ink? Ink provides the React experience for command-line apps. Build interactive CLIs using JSX components, hooks, and flexbox — just like building a web app, but for the terminal. Quick Start npm install ink react import React , { useState , useEffect } from ' react ' ; import { render , Text , Box } from ' ink ' ; function App () { const [ counter , setCounter ] = useState ( 0 ); useEffect (() => { const timer = setInterval (() => { setCounter ( prev => prev + 1 ); }, 100 ); return () => clearInterval ( timer ); }, []); return ( < Box flexDirection = "column" padding = { 1 } > < Text bold color = "green" > My CLI App </ Text > < Text > Counter: { counter } </ Text > </ Box > ); } render (< App />); Layout With Flexbox < Box flexDirection = "row" gap = { 2 } > < Box width = "50%" borderStyle = "round" pa
Continue reading on Dev.to React
Opens in a new tab

