Remix.run Logo
tayo42 6 hours ago

Is this a react feature or did they build something to translate react to text for display in the terminal?

sbarre 5 hours ago | parent | next [-]

React, the framework, is separate from react-dom, the browser rendering library. Most people think of those two as one thing because they're the most popular combo.

But there are many different rendering libraries you can use with React, including Ink, which is designed for building CLI TUIs..

skydhash 4 hours ago | parent [-]

Anyone that knows a bit about terminals would already know that using React is not a good solution for TUI. Terminal rendering is done as a stream of characters which includes both the text and how it displays, which can also alter previously rendered texts. Diffing that is nonsense.

9dev 3 hours ago | parent [-]

You’re not diffing that, though. The app keeps a virtual representation of the UI state in a tree structure that it diffs on, then serializes that into a formatted string to draw to the out put stream. It’s not about limiting the amount of characters redrawn (that would indeed be nonsense), but handling separate output regions effectively.

pkkim 6 hours ago | parent | prev | next [-]

They used Ink: https://github.com/vadimdemedes/ink

I've used it myself. It has some rough edges in terms of rendering performance but it's nice overall.

tayo42 6 hours ago | parent [-]

Thats pretty interesting looking, thanks!

embedding-shape 6 hours ago | parent | prev | next [-]

Not a built-in React feature. The idea been around for quite some time, I came across it initially with https://github.com/vadimdemedes/ink back in 2022 sometime.

tayo42 5 hours ago | parent | prev [-]

i had claude make a snake clone and fix all the flickering in like 20 minutes with the library mentioned lol