IN

Ink

ink

React for CLI

State Management
react
cli
jsx
stdout
components
command-line
preact
redux
print
render
Stars
40k
Weekly
5.8M
Open issues
33
Bundle
~15 kB

Installation

npm install ink

Code example

import { create } from "ink";

const useStore = create((set) => ({
  count: 0,
  inc: () => set((s) => ({ count: s.count + 1 })),
}));

export function Example() {
  const { count, inc } = useStore();
  return (
    <button type="button" onClick={inc}>
      Count: {count}
    </button>
  );
}

Pros & cons

Pros

  • Actively maintained by Vadim Demedes
  • 5.8M weekly downloads. Battle tested
  • MIT licensed

Considerations

  • Adds roughly ~15 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 33 open issues on GitHub

FAQs

Alternatives & similar libraries