Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> ``` function WelcomeMessage() { return ( <div> Welcome to <i>our platform</i>! <a href="/start">Get started</a> today. </div> ); } ```

Not the point here, but is there any move yet in React to separating the presentation from the logic[1]?

1 - https://martinfowler.com/eaaDev/SeparatedPresentation.html



I wouldn't expect there to be any.

Sometimes your presentation varies depending on the data, in ways that are ultimately Turing-complete. Any domain-specific-language is eventually going to grow to incorporate some kind of logic.

React seems to have found a sweet spot for that with JSX, which presents as if it's mostly HTML with some Javascript mixed in. (In reality, it's actually Javascript with HTML-esque syntactic sugar, but it works very hard to present the illusion.) That means that it's working in two well-understood and widely-supported languages, rather than creating yet another presentation language.

HTML+CSS has deep flaws as a presentation language, but it's also universal. I don't expect React to reinvent that particular wheel.


I believe tRPC could be a great solution to separate logic, generally speaking. However it also depends on what type of logic - some logic, like state/behaviour of the sidebar/modals will always remain client side.




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

Search: