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
React - Browser error: fn.apply is not a function #8835
Comments
Found my problem... I wasn't exporting a proper React component. |
Could we make this error message a little better? I just hit this one too and it was super confusing. Also a warning about missing a default export in a |
Good idea @mnpenner - any interest in trying to fix this? |
I just faced this. Clearly it is caused by not reading the docs better 😬 |
@XingXiaoWu do you have a repro? we recommend TitleCase for story names and use that all the time |
I can provide it,but Vue Startup Steps:
File locationThe story file is located in vue-demo/stories/ 3-freetable.stories.js Repetition steps
Modified to
Expected behaviorNormal behavior Actual behaviorError : fn.apply is not a function |
I have the same issue, my example is deps:
|
@towry do you have a public repro? i can't imagine why this problem might occur. |
I just created one: https://github.com/pze/storybook-vue-issue
|
Thanks everyone, for the tip to check for missing Defined storyFn: export const MyComponentStory = () => {
return (
<MyComponent />
);
} This usage caused the error: storiesOf('Components', module).add('MyComponent', MyComponentStory()); It resolved when I added the storiesOf('Components', module).add('MyComponent', () => MyComponentStory()); |
I have a similar issue when using Vite as a bundler. I posted my question with all the details on SO here: https://stackoverflow.com/questions/70420749/storybook-with-vite-error-fn-apply-is-not-a-function |
The stack overflow solution is that a decorator was causing the problem, so it sounds like folks here might want to check that any decorators they are using (including global decorators in preview.js) are correct. I'd also recommend that everyone try out CSF3, in which stories are exported as objects, rather than functions. |
Describe the bug
Most of my components produce the following error in the browser.
TypeError: fn.apply is not a function
To Reproduce
Steps to reproduce the behavior:
npm run storybook
Expected behavior
No error, show my component
Screenshots
System:
The text was updated successfully, but these errors were encountered: