News for hackers. Stuff that matters.
Re:Ink: React for Interactive CLI Apps by slashdave on Friday November 01, 2024 @12:30PM (#42018662)
Node.js is not necessarily bad, but React? What makes React great is the ability to embed the DOM in your app. For CLI? Square peg, round hole.
Re:Ink: React for Interactive CLI Apps by MrJohz on Friday November 01, 2024 @01:24PM (#42019334)
I'm not sure that's true. There's lots of ways to use and manipulate the DOM. But React is particularly special because it turns out to be a simpler way to think about UI components. A TUI has nothing to do with the DOM, but it's got a lot to do with rendering UI components. So taking the ideas from React and applying them to drawing elements in a terminal makes a lot of sense.

Arguably it makes even more sense than with React. One of the problems with React is that the underlying DOM is a stateful, imperative system, whereas React wants to behaves much more like an immediate-mode system, where the whole UI can be dropped and re-rendered at any time. But the terminal is not stateful like the DOM, and a more immediate-mode paradigm arguably works better in this context than in the browser.

Re:Ink: React for Interactive CLI Apps by hombre_fatal on Friday November 01, 2024 @01:05PM (#42019121)
What makes React great is that you write a UI tree that updates when state changes instead of imperative code like a clearRect() + drawLine() cycle.

This project and others like React Native show that it works outside of the DOM: you just render something else instead.

Thinking that React is only helpful for DOM UI seems like a misunderstanding of what React is and what makes it great.

Re:Ink: React for Interactive CLI Apps by lowboy on Friday November 01, 2024 @12:53PM (#42018954)
React enables declarative UI code instead of imperative. That's one of its biggest values. Even in the terminal, especially as the complexity of a tool increases.