question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow the use of another rendering than DOM

See original GitHub issue

I discussed a lot about this feature on Slack, and now I come to you with some real news and experiences.

At the moment, Hyperapp is used as “a JavaScript library for building frontend applications” (from the readme). But I was fall in love about Hyperapp, and I think it can allow a lot more.

Thinking about it Hyperapp is a store (state/actions management) with a render on update feature. Now Hyperapp is rendering on the DOM through its VDOM logics. But I am not asking to remove it.

What I am asking is to permit user to use the view function for something else than rendering into the DOM.

I found a pretty clean solution to do that in less than 10 Bytes (min+gzip). https://github.com/Swizz/hyperapp/commit/3109c4638ef070b0d5bbb6dcfa7ba6298a711c68

But this one is not really good and work only in a node context, because in a node context you are able to override document.body.

Another solution could be to do not call the patch function if appView() to do not return anything. https://github.com/Swizz/hyperapp/commit/d9608af656e6a267cdce9937581ce584d5e40854

And this one make sense too, as returning nothing from a view may cause an error. https://github.com/hyperapp/hyperapp/blob/fragment-state/src/app.js#L209

I dont know what I am supposed to write to convince you so I made a pretty simple example of a terminal app using Hyperapp.

demo repo : https://github.com/Swizz/hyperapp-term-poc app : https://github.com/Swizz/hyperapp-term-poc/blob/master/src/app.js

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
jorgebucarancommented, Oct 6, 2017

@Swizz Now that #385 is merged, you are welcome to send us a PR. 🔥🤘🔥

0reactions
Swizzcommented, Oct 7, 2017

I’m gonna close this one until further works

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it OK to use React.render() multiple times in the DOM?
Yes, it is perfectly fine to call React.render multiple times on the same page. Just as you've suggested, the React library itself is...
Read more >
How to Use One Component to Render Many HTML ...
When rendering DOM elements in a component, a fragment allows you to group together your DOM elements inside a pseudo wrapper.
Read more >
Managing DOM components with ReactDOM - LogRocket Blog
ReactDOM renders components or JSX elements to the DOM. The ReactDOM object has only a handful of methods; you've probably used the render() ......
Read more >
Conditional Rendering - React
Conditional rendering in React works the same way conditions work in JavaScript. Use JavaScript operators like if or the conditional operator to create...
Read more >
Replacing render with createRoot · Discussion #5 - GitHub
Second, this change allows us to remove the hydrate method and ... import * as ReactDOMClient from 'react-dom/client'; function App() ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found