[英]React Storybook not Recognizing a Story
I am testing a react app with storybooks.我正在测试一个带有故事书的 React 应用程序。 For some reason my custom story is not loading properly.
出于某种原因,我的自定义故事加载不正确。 If I write my custom story in
1-Button.stories.js
is renders but if its in 2-MyFunction.stories.js
, it doesn't render如果我在
1-Button.stories.js
编写我的自定义故事是渲染,但如果它在2-MyFunction.stories.js
,它不会渲染
In the src/stories
directory, I have 3 files:在
src/stories
目录中,我有 3 个文件:
0-Welcome.stories.js
1-Button.stories.js
2-MyFunction.stories.js
This is my .storybook/main.js
:这是我的
.storybook/main.js
:
stories: ['../src/**/*.stories.js'],//similar to config.js
addons: [//similar to addons.js
'@storybook/preset-create-react-app',
'@storybook/addon-actions',
'@storybook/addon-links',
],
};
Here is the MyFunction.stories.js
:这是
MyFunction.stories.js
:
import MyFunction from '../Components/MyFunction;
export const Functiontest = () => <MyFunction .../>;
I didn't include the code for the tab name我没有包含选项卡名称的代码
export default {
title: 'function'
};
...
export const functiontest = () => {
return <My function ...>
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.