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.

Using yo-yo elements (or other native DOM) in a Hyperapp view

See original GitHub issue

Hi! Thanks for your work, great project, got me very excited (couldn’t sleep when I first read the wiki).

Out of curiosity re-wrote my tiny markdown editing app from choo to hyperapp. Stepped into an issue: if I convert all components to hyperx/jsx, all is peachy. However when I tried to use a yo-yo (native HTML elements / real DOM) component, I’m not sure I understand the right approach. I’ve looked at the CodeMirror example, but still.

Here’s my editor: https://github.com/arturi/tent/blob/4cca75742b0bd3e8d880c2b42df374a78cf959fb/index.js#L184-L189. And here I’m trying to use it in a view: https://github.com/arturi/tent/blob/4cca75742b0bd3e8d880c2b42df374a78cf959fb/index.js#L209-L213.

The original editor component used just return a DOM element (textarea) and fire a callback (onkeyup), whenever something was typed, so I could update state/model. Now I’ve changed it to return both the element an update method, so I could update it with hyperapp, but not sure that’s a thing to do, and it doesnt really work.

Thank you!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
arturicommented, Mar 7, 2017

Yes, thank you! I’ll try to maybe add some examples to the wiki if I can nail it down.

1reaction
jorgebucarancommented, Mar 4, 2017

I got it working after a lot of fiddling, turns out, you have to pass an element from onupdate to an update function too.

It always seems impossible until it’s done 😉

And, yup. That’s what I tried to say with I’d use “…onupdate to update props/options.”

@arturi From what you are saying it seems that choo/yo-yo actually works well with these “dumb” components.

CodeMirror was notoriously difficult to get working, though, but I guess CodeMirror is the exception rather than the norm.

Like in everything, there’s a trade-off here. See benchmarks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with DOM elements of view components in Hyperapp
The function where we work with the real DOM elements (I'm going to call it the "element processor") will be called with its...
Read more >
Hyperapp - Tiny Library for Frontend Applications - SurviveJS
Hyperapp is a JavaScript library for building frontend applications. In this way, it's similar to others like React, Vue or Ember. Hyperapp ......
Read more >
Full list of all posts - Kula.blog
Life categories. Work-life balance and much more. Have you ever wondered how to balance your life and make sure you live with your...
Read more >
Hyperapp state machine web app - Gleb Bahmutov
How to write a web application using a state machine and Hyperapp ... and elements, but a model that changes from one state...
Read more >
Fury Cake Yoyo Trick - Learn How - YouTube
Download our Free App to Learn Tricks, get XP and Level Up: https:// yoyotricks.com/app/ Join our Discord: discord.gg/ yoyotricks … Show more.
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