Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Storybook调用函数,它是组件的一个道具_Javascript_Reactjs_Storybook - Fatal编程技术网

Javascript Storybook调用函数,它是组件的一个道具

Javascript Storybook调用函数,它是组件的一个道具,javascript,reactjs,storybook,Javascript,Reactjs,Storybook,我有一个组件“Item”和一个容器。容器有一个延迟加载函数,我用它加载项目。因此,我必须触发该函数,以显示项目。如何触发storybook中的函数 // Container.js with Item component <Item key={post.id} lazyLoading={this.lazyloading.bind(this)} //I need to trigger this function, to load the

我有一个组件“Item”和一个容器。容器有一个延迟加载函数,我用它加载项目。因此,我必须触发该函数,以显示项目。如何触发storybook中的函数

// Container.js with Item component
        <Item
          key={post.id}
          lazyLoading={this.lazyloading.bind(this)} //I need to trigger this function, to load the posts     
          text={this.props.text}
          styles={this.props.styles}
        />



// Item.stories.js
    let key = 1;
    let text = "test";
    let styles = { 
      backgroundColor: 'red',
    }
    storiesOf('Item', module).add(
  'default',
  (() => (
    <Item
      key={key}
      text={text}
      styles={styles}
      lazyLoadingImage={} // How can I call this function? 
    />
  ))
);
//带有项组件的Container.js
//Item.stories.js
设key=1;
让text=“test”;
让样式={
背景颜色:“红色”,
}
storiesOf('项目',模块)。添加(
“默认值”,
(() => (
))
);