Function in Props
See original GitHub issueWhen i put some functions on the Component, the Whole function including __WEBPACK_IMPORTED_MODULE...
shows on jsx addons.
even with @storybook/addon-actions
, JSX preview has shown as
<Calendar
onSelect={function action() {
for (var _len = arguments.length, _args = Array(_len), _key = 0; _key < _len; _key++) {
_args[_key] = arguments[_key];
}
var args = _args.map(_util.prepareArguments);
var channel = _addons2.default.getChannel();
var id = (0, _v2.default)();
channel.emit(_.EVENT_ID, {
id: id,
data: { name: name, args: args }
});
}}
/>
This is not what I expected… but is this intended?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Components and Props - React
This function is a valid React component because it accepts a single “props” (which stands for properties) object argument with data and returns...
Read more >How To Pass A Function As A Prop In React? - Tim Mousk
Create a function in the parent component that accepts a callback as an argument. · Pass the function to the child component as...
Read more >Full React Tutorial #13 - Functions as Props - YouTube
Course Files:+ https://github.com/iamshaunjp/Complete-React-Tutorial JOIN THE GANG ...
Read more >React tutorial for beginners #20 Pass Function as Props
In this react js tutorial for beginners series we learn how to pass function as a props in child component in react js....
Read more >How to Use and Pass Functions as Props— React - Medium
This has been the basics of passing functions as props in React. I hope this has given some insight on how to start...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is a quick util function I wrote.
to use it just import the util function instead of the library function.
Hmm, I think we could improve this by adding a toString on the
action
returned function: https://developer.mozilla.org/nl/docs/Web/JavaScript/Reference/Global_Objects/Function/toString