Hacker News new | past | comments | ask | show | jobs | submit login

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.



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.


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.


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: