You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I am pretty confused about what seems to be a pretty typical use case in React. I have a ContactBlock component that takes a few props including an onClick prop, which is a function. I also have a ContactSidebar component that creates a list of those ContactBlock components with different values, like an onClick prop for one that opens your email client and another that opens a contact form page.
I'm able to create the story for ContactBlock and pass action('clicked') as a prop for onClick successfully:
That works as expected, and I can see the action logged in the panel when running locally. However, that action is not logged in the story for ContactSidebar:
Nothing is logged in the actions panel at all, and additionally I get this console error: "Uncaught Error: Expected onClick listener to be a function, instead got a value of object type." What am I missing here?
Update: I thought by fixing my import statement and using this in my content sidebar story I'd fix it, but no dice. It's still throwing that same error and not logging in the actions panel.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
So I am pretty confused about what seems to be a pretty typical use case in React. I have a
ContactBlock
component that takes a few props including anonClick
prop, which is a function. I also have aContactSidebar
component that creates a list of thoseContactBlock
components with different values, like anonClick
prop for one that opens your email client and another that opens a contact form page.I'm able to create the story for
ContactBlock
and passaction('clicked')
as a prop foronClick
successfully:That works as expected, and I can see the action logged in the panel when running locally. However, that action is not logged in the story for
ContactSidebar
:even though the actual component honestly just passes the prop through:
Nothing is logged in the actions panel at all, and additionally I get this console error: "Uncaught Error: Expected
onClick
listener to be a function, instead got a value ofobject
type." What am I missing here?Update: I thought by fixing my import statement and using this in my content sidebar story I'd fix it, but no dice. It's still throwing that same error and not logging in the actions panel.
Beta Was this translation helpful? Give feedback.
All reactions