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

children[0] is not a function #21

Open
lake2 opened this issue Oct 11, 2019 · 3 comments
Open

children[0] is not a function #21

lake2 opened this issue Oct 11, 2019 · 3 comments

Comments

@lake2
Copy link

lake2 commented Oct 11, 2019

the sample code to reproduce the issue:
https://codesandbox.io/s/wonderful-edison-147v9

What should I do if I want inject one store and use it by context?

@lake2
Copy link
Author

lake2 commented Oct 14, 2019

Is there anyone can help me? That will be appreciated.

@philmander
Copy link
Collaborator

Forgive me, I'm a bit rusty on this. The issue is fixed if you remove <Observer>. I'm not sure if this because of a problem with Observer, the way you're using it or a Preact 10 compatibility issue.

You can do this as an alternative:

const App = observer(() => {
  const store = useStore();
  return (
      <div>{store.a}</div>
  );
});

@lake2
Copy link
Author

lake2 commented Oct 15, 2019

Thanks! Can useMemo and useCallback work when component is be wrapped ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants