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.

Hyperapp do not call oncreate handler when view mounted to document.body

See original GitHub issue

Code:

import { h, app } from 'hyperapp';

function view() {
  return (<div oncreate={() => console.log('log oncreate')} />);
}

app({}, {}, view, document.body);

In this case we do not see a message log oncreate. It take some time to understand that app mount view to body and this element is not re-created. Maybe I miss something, but I have assumption that this handler should be called in any case when view mounted first time.

I solve a “problem” in this way: just add element with ID and mount view to it.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jorgebucarancommented, Feb 13, 2018

@jmas Absolutely, https://github.com/hyperapp/hyperapp/pull/590 is also somewhat related to this. Thanks for bringing this up!

1reaction
jmascommented, Feb 12, 2018

@JorgeBucaran Thanks for explanation. Now I see. I double checked this: if I have non-empty container oncreate is not called. I guess this should be mentioned somewhere in docs to prevent misunderstanding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

hyperapp - npm
Hyperapp is a JavaScript micro-framework for building web applications. ... </div> ) app(state, actions, view, document.body). Hyperapp ...
Read more >
Hyperapp V2 lifecycle method (onCreate) - Stack Overflow
1 Answer 1 · Then how are we supposed to fetch data or do any task at the creation time of any component?...
Read more >
Functional Programming in JavaScript with Hyperapp - Medium
])window.main = app(state, actions, view, document.body). You can also use JSX instead of calling the h function to create elements.
Read more >
hyperapp: Versions - Openbase
app" export const main = app(state, actions, view, document.body) ... If you don't call the function, the element will not be removed.
Read more >
tmuxinator - OSCHINA - 中文开源技术交流社区
tmuxp, tmux session manager. built on libtmux. We need help! tmuxp is a trusted session manager for tmux. If you could lend your...
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