Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Life cycle hook doesn't work when you have a template called before it. #11

Open
rosostolato opened this issue Aug 14, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@rosostolato
Copy link
Contributor

rosostolato commented Aug 14, 2023

If you create a template before calling the component life cycle hook (onInit, onDestroy), it won't work:

function App() {
  const template = <MyComponent />;

  onDestroy(() => {});

  return (
    <div>{template}</div>
  );
}

image

@rosostolato rosostolato added the bug Something isn't working label Aug 14, 2023
@rosostolato rosostolato changed the title bug: life cycle hook doesn't work when you have a template called before it. Life cycle hook doesn't work when you have a template called before it. Aug 14, 2023
@rosostolato
Copy link
Contributor Author

I realized that it doesn't work when the template is mounted before you call the hook. Need to update the currentComponent to be an instance stack with all the component tree within it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant