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

Cannot use hooks inside of components story #36

Closed
lihanqi opened this issue Apr 10, 2020 · 2 comments
Closed

Cannot use hooks inside of components story #36

lihanqi opened this issue Apr 10, 2020 · 2 comments

Comments

@lihanqi
Copy link

lihanqi commented Apr 10, 2020

Describe the bug
Cannot use React hooks in the story directly because of directly call on component like a fuction. I have a temporary workaround by placing the following code in front of with addDecorator(withThemesProvider(themes));. But I feel this might be an issue inside of withThemesProvider

`addDecorator(Story => <Story />);

To Reproduce
Steps to reproduce the behavior:

  1. Have a story written with React Hooks
  2. Go to the storybook
  3. See error

Expected behavior
Storybook should render as normal

Screenshots
image

Desktop (please complete the following information):

  • OS: MacOS Catalina V10.15.4
  • Browser Chrome
  • Version v80
@semoal
Copy link
Owner

semoal commented Apr 10, 2020

Hi @lihanqi , i found the issue, i'll push a minor version, thanks for opening the issue mate.

semoal pushed a commit that referenced this issue Apr 10, 2020
### Bug Fixes

* fixed issue that running hooks inside stories crashed [#36](#36) ([b7de87e](b7de87e))
@semoal
Copy link
Owner

semoal commented Apr 10, 2020

Released mate, on v1.5.1, feel free to open anything out that you aren't happy.

@semoal semoal closed this as completed Apr 10, 2020
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