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.

React - Browser error: fn.apply is not a function

See original GitHub issue

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:

  1. npm run storybook
  2. Error shows up in browser

Expected behavior No error, show my component

Screenshots Screen Shot 2019-11-14 at 11 05 09 AM

System:

Environment Info:

  System:
    OS: macOS 10.15.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
    Yarn: 1.19.0 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
  Browsers:
    Chrome: 78.0.3904.97
    Safari: 13.0.3
  npmPackages:
    @storybook/react: ^5.2.6 => 5.2.6 

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

34reactions
tonyjmartinezcommented, Nov 14, 2019

Found my problem… I wasn’t exporting a proper React component. This export const card = <Card>This is a card</Card>; Should have been this export const card = () => <Card>This is a card</Card>;

5reactions
XingXiaoWucommented, Jun 8, 2020

same question. but it looks like can’t use Upper Camel Case just like

export const Basic = () => ({...})

image

when I use little camel-case

export const basic = () => ({..})

it’s ok. image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storybook with Vite error: fn.apply is not a function
I found a similar issue on Storybook's GitHub, and tried to change names StorybookName to storybookName in all the stories, also checked all...
Read more >
'X' is not a function TypeError in React [Solved] | bobbyhadz
Another common reason the "Uncaught TypeError: X is not a function" error occurs in React is when we try to call a function...
Read more >
Type error: fn is not a function. I don't know how to fix that.. Any ...
I've been trying to code a Discord bot to do a Timed mute, but there seems to be an error which I don't...
Read more >
TypeError: "x" is not a function - JavaScript - MDN Web Docs
Maybe there is a typo in the function name? Maybe the object you are calling the method on does not have this function?...
Read more >
How to solve the "is not a function" error in JavaScript
Join the waiting list, reserve your spot in my 10-weeks cohort course and learn the fundamentals, HTML, CSS, JS, Tailwind, React, Next.js and...
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