简体   繁体   English

React Storybook 中的 TaskHarness

[英]TaskHarness in React Storybook

I have a really serious problem.我有一个非常严重的问题。 I created a Storybook under React.我在 React 下创建了一本故事书。 I am not getting the correct values on the Docs site as shown here.我没有在 Docs 网站上得到正确的值,如此处所示。

在此处输入图像描述

Normally, it should give me something like:通常,它应该给我类似的东西:

在此处输入图像描述

and the values should be changed.并且值应该改变。

Here is my component file:这是我的组件文件:

// Button/index.tsx
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { Button as MButton } from '@material-ui/core';
import clsx from 'clsx';

export interface IButtonProps {}
const useStyles = makeStyles({});

const Button: React.FC<IButtonProps> = (props) => {
   return ();
};

export default Button;

And this one is my story file:这是我的故事文件:

// index.stories.tsx
import { withPerformance } from 'storybook-addon-performance';

export default {
   decorators: [withPerformance],
} as Meta;

Any idea how to solve it?知道如何解决吗?

I solved this problem by removing withPerformance from decorators.我通过从装饰器中删除 withPerformance 解决了这个问题。

Edit: Here is the solution:编辑:这是解决方案:

import { addDecorator } from '@storybook/react';
import { withPerformance } from 'storybook-addon-performance';

addDecorator(withPerformance);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM